Have programmers at your work not taken up or been averse to an offer of a second monitor?

I'm putting together a business case for the developers in my company to get a second monitor. After my own experiences and research, this seems a no-brainer to me in terms of increasing productivity and morale/happiness. One question which has niggled me is if I should be pushing to get all developers onto a second monitor or let folk opt-in (i.e. they get one if they want one). Thoughts on this are welcome, but my specific question relates to a snippet on this site: > But when the IT manager at Thibeault's company asked other employees if they > wanted dual monitors last year, few jumped at the offer. Blinded by my own pre-judgement, this surprised me. Has anyone else experienced this? I fully appreciate that some people prefer a single larger monitor, but my general experience of researching the web suggests that most programmers prefer a dual (or more) setup. I'm guessing this should be tempered with the thought that those developers who contribute to such discussions might not be considered your average developer who might not care one way or the other. Anyway, if you have experienced the above have you tried to sell the concept of dual monitors to the masses? If everyone just got 2 monitors regardless if they wanted it or not, were there adverse reactions or negative effects? UPDATE: The developers are on a mixture of 17", 22", or 24" single monitors. The desks should be able to accommodate dual 22" monitors as I am proposing, though this will take some getting used to I imagine.


Simple task framework - building software from reusable pieces

I'm writing a web service with several APIs, and they will be sharing some of the implementation code. In order not to copy-paste, I would like to ideally implement each API call as a series of tasks, which are executed in a sequence determined by the business logic. One obvious question is whether that's the best strategy for code reuse, or whether I can look at it in a different way. But assuming I want to go with tasks, several issues arise:   1. What's a good task interface to use?   2. How do I pass data computed in one task to another task in the sequence that might need it? In the past, I've worked with task interfaces like:               interface Task<T, U> {         U execute(T input);     }      Then I also had sort of a "task context" object which had getters and setters for any kind of data my tasks needed to produce or consume, and it gets passed to all tasks. I'm aware that this suffers from a host of problems. So I wanted to figure out a better way to implement it this time around. My current idea is to have a TaskContext object which is a type-safe heterogeneous container (as described in Effective Java). Each task can ask for an item from this container (task input), or add an item to the container (task output). That way, tasks don't need to know about each other directly, and I don't have to write a class with dozens of methods for each data item. There are, however, several drawbacks:   1. Each item in this TaskContext container should be a complex type that wraps around the actual item data. If task A uses a String for some purpose, and task B uses a String for something entirely different, then just storing a mapping between String.class and some object doesn't work for both tasks. The other reason is that I can't use that kind of container for generic collections directly, so they need to be wrapped in another object.   2. This means that, based on how many tasks I define, I would need to also define a number of classes for the task items that may be consumed or produced, which may lead to code bloat and duplication. For instance, if a task takes some Long value as input and produces another Long value as output, I would have to have two classes that simply wrap around a Long, which IMO can spiral out of control pretty quickly as the codebase evolves. I briefly looked at workflow engine libraries, but they kind of seem like a heavy hammer for this particular nail. How would you go about writing a simple task framework with the following requirements:   * Tasks should be as self-contained as possible, so they can be composed in different ways to create different workflows.   * That being said, some tasks may perform expensive computations that are prerequisites for other tasks. We want to have a way of storing the results of intermediate computations done by tasks so that other tasks can use those results for free.   * The task framework should be light, i.e. growing the code doesn't involve introducing many new types just to plug into the framework.


Heredoc or an external template file in my bash script - how it affects readibility/maintanance?

I realise that this question may be down to personal preference but I'm pretty new to bash/shell scripting so thought it'd be worth some research to see if there's some sort of standard/best practise or agreeable consensus. \-- I'm working on a few scripts that I'd eventually like to release open source (probably MIT license) so I'd like the scripts to be "done right", if there is such a thing -- The script in question has to produce an output text file from a template using variable substitution/expansion to 'fill in the blanks' as it were. At present I am using the `heredoc` method but I'd like to preserve TAB indents, both in my script and in the output (for readability). Whilst I have achieved this to a certain extent using `cat <<-EOF` to strip the leading tabs (from my script) and by using a variable to store the TAB space (e.g. `T="$(printf '\t')"`) which I then reference with `$T` which is then interpreted correctly within the heredoc back in to a TAB character, I can't help but think if an external file would just be simpler? What do any of you more experienced bash scripters can say about it? Which of those practices is better when it comes to the code readibility/maintanance? * * * Here's a quick example of what I mean...               my_function() {         T="$(printf '\t')"         cat <<- EOF             This is my template for $something             $T  I'm indented with the TAB space variable...             $T  ...but actually I'm indented twice because the "<<-" only strips the 'leading' tabs             There's something else that I need, but it might be \${printed_literally}/$or_expanded which is cool!         EOF     }      It's nothing _special_ really, I'm not looking for a 'solution' as such, more just some guidance on which solution to use -- i.e. _heredoc_ in the script or an external template file?


Is there a compliance test for C++ compilers?

**Is there, somewhere, a freely usable/accessible script, source file, or whatever, that is able to measure the compliance of a given C++ compiler?** For example, the Acid3 test for browsers: http://acid3.acidtests.org/ The results I dream of would be a global percentage note (or multiple notes, one for each standard, e.g. , c++98, c++11, c++14, etc.), and then detailed tests with "success" or "failure" for each of them. _Background: I had a discussion at work about boost and some challenged compilers. My interlocutor spoke about boost being an academic project, because it won't work in major C++ compilers, and me answering that mentally challenged compilers should not count. Being able to measure with code the actual conformance of a compiler would help both in evaluating the compiler, and discovering the "corner cases" that should be avoided in cross-platform code compiled with them._ ### Edit: 2013-06-22 Not an answer, but apparently, the C++ committee is working on the subject: > _**SG10, Feature Test:** Clark Nelson (Intel). Investigation into whether > and how to standardize a way for portable code to check whether a particular > C++ product implements a feature yet, as we continue to extend the > standard._ Source: http://isocpp.org/std/the-committee


What are the advantages of using LISP and Haskell? Will they make me a better programmer?

I know Lisp and Haskell are functional and logic programming languages respectively, but what exactly does this mean? How do they differ from other languages? I've heard that learning these will make you a better programmer and improve your logic. Is this true, and if I go learning Lisp or Haskell to a competent level will my programming improve and will I be better at handling any problem in any language? I just wanted to know to see if they are worth the effort of learning. Also are these languages useful in areas such as GUI and graphics or are they just useful for console applications?


Languages with graph data structures and algorithms in standard library

I am trying to improve my knowledge and ability with graphs and graph algorithms and have noticed something curious: as far as I can tell no "mainstream" language contains support for graphs in its standard library. Trees yes, graphs no. The only language that comes even remotely close is C++ with Boost (which isn't technically a "standard library") I'm not sure exactly why this is, but it's got me wondering: are there any programming languages out there that come with solid support for graphs as part of their standard library? Edit: To clarify: by "graph" I mean a network of nodes and edges; the sort of thing you'd run Dijkstra's algorithm on, not a "graph" in the sense of "graphical display of data".


Is there any value in knowing the execution time for a unit test?

Is the execution time of a unit test useful for anything? Is a unit test an appropriate place for any sort of code profiling? Why or why not? **Sample Use Case** :   * Every unit test lists name, pass/fail, and execution time.   * Time is also calculated per unit test class and total test suite execution time. How could I use this info?


PocoCapsule project status

Does anybody know the status of this C++ Inversion of Control Container? Any alternative?


Where should authentication be handled, in the server's code, or in the application's server-side code?

I'm developing a simple web application in node.js. Users can log in from any page in the application, so I handle authentication in the server's code and logic, and the application's server-side code checks to see if a couple session variables are set. If they are, the application continues with user- specific information. I'm unsure if this is the best way to handle the authentication logic. Should I move all authentication completely over to the application's code and only have the server listen and pass requests along, or, since the server is setting the session anyway, should I have it control back-end authentication logic as I'm handling it now? In the end, what I'm really asking is: Conceptually, where should authentication be handled? In the server's code, or in the application's server-side code? * * * **Edit:** To be more specific, it's a public application on the internet. The logic that I'm questioning is entirely the _server-side_ logic. Thank you for pointing that out to me. I edited my title to make it a little more accurate.


What is a key event Dispatcher in keyboard-interactive apps?

What is a : > **Key-Event Dispatcher ?** in keyboard-interactive apps. What does it really do ?


Any ideas on a new input modality?

Don't get me wrong. I love typing. I'm good at it, and the harmonious clicking of my Das Keyboard brings me pure joy. But for some reason, I just fingertips all over my monitor and started swirling them around. It's all dirty now, but man, this wooshing around really got me thinking. I know this is blasphemous, but do you believe that it could be possible (or definite) that there is a more effective way of coding than our current line by line, 1/3 english, 1/3 strange symbols, 1/3 numbers keyboard inputting? Honestly, I'm not really sure what I have in mind here, but punch cards got knocked down. What's next?


How to keep up your motivation all day long

This might be a bit subjective and maybe that's a problem here, but I'm asking my question anyway :) Also, I found similiar questions (but none, answered my question), so you don't need to remind me to that, thanks. About my question: I have problems to keep my motivation/concentration the whole day up. I mean, in the morning until after the lunch it's all good. The problem usually starts round about 3pm-4pm, where I have (on hard days) massive problems. I get some sort of writer's block and can't think straight about problems anymore. I often just stare at the code and nothing... I know I need to solve problem X or achive something Y with my code. But it feels like my brain can't (or can hardly) make the connection between an idea and the actual code, I'd need to do this, anymore. Usually relax methods don't really work anymore, when this point is arrived. When I have some extra hours on my account, then I usually call it a day and go home. But obviously I can't do this anytime, sometimes something just needs to get done soon or I need the extra hours. I know, this is a sign of my body that I can't keep this up anymore without a longer rest. And I know (and you guys, too) that this job can be mentally really exhausting. (I work with sharepoint...) Don't get me wrong, I like my job, but I really do feel bad when I can't do with all the passion I'd want to and slack off in the later hours of the day. It just feels like my power is drained for the rest of the day for mental work. And now my actual question. Do you guys experienced similiar? What did helped you? How can you sustain your power for the whole day? (I just don't want to ask myself at the end of the day "why was I so "lazy" the last 1-2 hours" anymore) This is really important for me, I hope someone can help.


Best design for data entry UI

I am working on a software project that is intended to replace the data entry done in Excel spreadsheets. We have a grid control that displays the data but it is edited in a form with tabs for different sections (over 60 columns in the spreadsheet). The users are complaining that it takes them longer with the tabbed form to enter the data that simply typing in a spreadsheet and moving to the next cell. So now I am wondering if there was an error in our UI design. Are there any good books or other resources which describe the most efficient UI for data entry?


Best practices to follow with database indexes

What are some DOs and DONTs for improving database performance using index? A DO would be a case in which an index should be created, or another indexes related tip that will improve performance. A DONT will be a case when an index shouldn't be created, or another index related action that can hurt the performance.


Are verb-like classes a code smell?

I do a lot of flat-file processing to extract data. The file "formats" are very unique and each file format requires a lot of format-specific code. Sometimes, the parsing code needs to maintain a lot of state while the file is being read. I've used something like this "pattern" at times:               parser = New FileTypeAParser(filename)     parser.ParseEnterFile     data = parser.ParsedData      Or, consider a class that factors large numbers. For efficiency reason, upon being instantiated, the class would internally generate and cache list a primes. It would then be called many times with different numbers like this:               factors = factorizer.Factor(veryLargeNumber)      **Original Question** The adage is _Class names should be nouns; method names should be verbs._ Is it a code smell to name and use classes in the way shown in the examples? If so, how do I refactor the examples to deodorize them and remove the code smell? **Revised Question** Based on the comments, I now realize that I _am_ using nouns. After putting more thought into it, I realized that my concern is that these classes very verb-like in substance and in name. Is this something to be concerned about?


Why would I write a DSL instead of a form based RIA?

I've been reading some papers recently on domain specific languages (DSL), but none of them appear to address the advantages of a DSL over a rich internet application (RIA). In an RIA, instead of learning the domain language, the user is provided with domain objects as form fields, which abstracts the lexical definitions for the domain language. This seems more usable. What I am missing?


Bad idea to display mail server info in public github project?

I have the project for work that requires me to send e-mails to people using our work mail server. The server doesn't require authentication. Part of my project is using a Java-Helper I'm developing on GitHub. I don't know if I completely understand how it all works, but I'm guessing it would be a bad idea to have the server information available on GitHub for the world to see. Is this correct? **After thought:** I'm not going to put it in the Java-Helper because that wouldn't be helpful for anyone but me. but I'm still curious to know the answer to this question :) Thanks!


How to TDD that the correct results are returned

I'm starting a new project, and trying very very hard to use TDD to drive the design. I've been pushing for years, and finally got approval to spend the extra time on this project to use it while I learn how to do it properly. This is a new module, to tie into an existing system. Currently, all data access happens through webservices, which for the most part are just a thin wrapper over database stored procedures. One requirement is that for a given store, I return all Purchase Orders that are considered valid for this application. A PO is considered valid if it's ship date falls withing a given range from the stores opening date (this is for new stores). Now, I can't put this logic in the application code, as I'm not going to bring back a million POs just to get the dozen that apply to could apply to this store given the constraint above. I was thinking, I could pass the date range to a GetValidPOs proc, and have it use those values to return the valid POs. But, what if we add another requirement to what is considered a valid PO? And how do I test this and verify it keeps working? We are not using an ORM, and it's unlikely to happen. And I can't call the DB in my test. I'm stuck. My other thought, is have some mocks that return valid data, others that return some bad data, and have the local repository throw an exception if bad data occurs, and test that the exception gets thrown if invalid data is returned by GetValidPOs proc (or the mock used in testing). Does this make sense? Or is there a better way? **UPDATE:** I am able to use EF it would seem. Now I just need to figure out how to use it, and make it testable, while still being able to rely on stored procedures, and the difficulty of having data scattered across several databases.


How meaningful is the concept of "software craftsmanship"?

There seems to be a lot of buzz around _software craftsmanship_ lately. Is it a well-defined concept? What does imply? To what extent is programming effectively a craft activity?


Why do node packages put a comma on a newline?

I'm learning node.js and am trying out Express. My first app had this code:               var express = require('express')       , routes = require('./routes')       , user = require('./routes/user')       , http = require('http')       , path = require('path');      Reading through the mongoose tutorial gives me this:               var mongoose = require('mongoose')       , db = mongoose.createConnection('localhost', 'test');      On strict mode, JSHint gives me > app.js: line 6, col 32, Bad line breaking before ','. Which shows that I'm not the only one out there who's bugged by this syntax. Is there any reason to declare `var`s this way instead of adding the comma at the end of the line?


How to be productive as an infrequent programmer?

My current day job is mostly project management and client liaison work, but I sometimes get involved in actual coding. I do this either because I have a clear vision of what I want the result to look like (and it's easier to implement than to explain it), because I have relevant expertise, or simply to add resources. But I'm finding a couple of recurrent issues:   1. The startup time to being productive can be prohibitive. Installing development tools, getting access to relevant systems, source code etc, and simply getting to the point of a first complete build.   2. The overhead of working on a fast-moving codebase can be prohibitive. It's not unusual on one of my projects to have to completely rebuild the environment (that is, check out and build all the code again, including creating a new local database, populating it etc) every month or so.   3. Worst of all, if I stop doing any coding for more than about 2 weeks, I completely lose all my mental "state": I don't remember where things are installed, I don't remember which of several working directories is "the right one", I don't remember how to resolve an error message I've seen several times in the past. (I suspect my mental state attrition is much faster than average.) I would really appreciate tips from anyone else in this situation. So far, I've worked out this much:   1. Only code in solid blocks of time - minimum 2 days. I can't get anything done at all in a few hours at a time.   2. Document, document, document. Keep spreadsheets that store state as much as possible. If there are several systems where code is deployed, record all key directories, port numbers, user names, database names etc etc. What else?


Alternativates to HTML Help

We currently use a system called AsciiDoc which allows us to create documentation in a simple text markup. From that we can generate multiple output formats. We only make use of the pdf output and chm output formats. I was wondering if there was an alternative to chm? What I am looking for is something that can be used off-line (this is important because quite a few of our users are in very remote places) with our software. It should have an index (it can be as simple as an html page with hyperlinked terms), it should be searchable and it should have a mechanism that allows specific entries to be called up from the code (similar to context sensitive help). The two things that are against PDF in this case is:   1. Context sensitive help isn't an option   2. Generally the document is rather large    3. PDF is more suitable to printed documentation than context sensitive help What I would like is to use html. The only problem with html is that I can't seem to figure out how to automatically provide a keyword search (other than the browsers ctrl+f functionality - I would like something more apparent). I also can't seem to find a method to automatically generate a hyperlinked index of key words. Context sensitive help would be simple because of the section tags - I could simply pass the url of the page and section that I am interested into the default browser and that page should load up to the correct section. My requirements sound an awful lot like chm - they do. I modeled my requirements off chm. The only reason I don't like chm is because of the way the code interacts with it using mapids and such. I would much rather use store a plain text list (that is automatically generated for me) that my code can use to access the context sensitive portion of the documentation. I am envisioning a script that would go through the html output files and generate an index page that simply contains a list of keywords that it found. obviously there should be word exclusion mechanism to ignore words like: the, it, is, etc.. This part would be relatively easy to write. The second part would need a script of some sort to put together a database of keywords and their location within the html text. I think this would be the tricky part along with providing the search mechanism within the browser. Any ideas on alternatives would be appreciated. I would love to use a wiki or set of static html pages hosted on a webserver somewhere, but we have a critical offline usage requirement. Simply placing the html on the local drive doesn't provide us with the search requirements that we need. **EDIT:** I design software that is used by the mining industry. A lot of mines are very remote and do not have access to the internet in any meaningful way. There is nothing wrong with pdf or html or chm (except that it is getting old). If I could display a pdf file at the correct location (i.e. context sensitive help) I would use it. I am almost tempted to write my own - basically it would be a portable wiki. Speaking of that, if you suggest portable wiki - you have to think of the end user which may have no experience in using such tools. It has to be dead simple. That was the beauty of chm, it is a pain to work with but the end users like it.


Profanity Filter Performance in Java

I have a requirement to filter profanity out of users' submissions in a Java- based web application. The client is aware of both the Scunthorpe Problem and the Clbuttic Problem and have accepted the consequences. Please, I don't desire a debate on the merits of lack thereof of censorship. There are two bits of data:   1. The user's submission, which can potentially contain 500 words or so;   2. A single-column database table containing words that are disallowed. There may be many thousands of records in this table. The present solution seems wrong to me:   1. The entire table is loaded into a static String[] on startup into a Singleton (thus residing in memory).   2. For each user submission we loop through the array and do a .indexOf() to see if any given word in the String[] appears in the submission.   3. If it appears, we replace with %$#@%-style characters. This is done by tokenizing the user submission, looping through the entire user submission as tokens (again), and replacing each instance of the found word. There may be brilliance in this solution, but I'm skeptical. And having looked at it for a while I can't find my way past it. Questions is, what is a solution that will give good performance and hopefully be reasonably sane for future developers to maintain after I get fired for failing to filter out some obscure word I've never heard of?


Why are Python strings allocated on the stack?

According to this Python code visualizer, Python strings are allocated on the stack and not on the heap. Why is this? I thought they would be similar to Java where Strings are allocated on the heap.


What's the canonical retort to "it's open source, submit a patch"?

The danger of ever suggesting some feature on a product, especially open source, is that you'll get the response, "why don't you do it?". That's valid, and it's cool that you can make the change yourself. But we know practically that products do often improve as programmers listen to the voice of users — even if those users are other programmers. And, the efficient way to make those changes can include someone who's already working on the project taking up the idea and implementing it. There are some common terms used to refer to software development problems. e.g. Bikeshedding. Is there a common term used that essentially replies, "Yes, I know that I can change just about anything in the world — even closed source. I could get hired, and go write that code. But in this case I'm just making an observation that may in fact be useful for another coder already well suited to easily make that change — or just generally discussing possibilities." [p.s. (a few days in) - I should have pointed out that "submit a patch" is often said with wry humor, and I'm seeking an appropriate witty response. ;)]


What are the different methods of dividing and organizing work among project team members?

In my team, everyone would like to do everything, including backend, frontend, middle layer. I told them that we should divide the work according to roles and area of expertise. What are the pros and cons of dividing the work vertically (each user story is done by the same person from the back end to the front end) versus dividing the work horizontally (each abstraction layer is done by the same person)?


Contract for App Development and Service Maintainence

I am going to develop iPhone application for clients, for fixed project cost. After that I will help maintain the application by charging a service/support fee. Questions:   1. What should I put into the contract? Any samples I can use for reference?    2. Do developers normally give their source code to the client? And what should be the price differences for each?    3. How are service/support normally charged? Monthly or by the hour? Any other advice welcome!


CSV file generation using Java

We have a requirement in our project to generate a big CSV file every 2 hours using a Java program. This file will have around 60,000 lines (around 120 characters per line). I am not sure about the size yet. I would like to know if I would run into any memory issues because I will open the file using FileWriter and then keep writing and then finally close the file. Should I worry about the size of the file? If yes, are there any other good techniques to write into a big file in Java other than using FileWriter? We are using Java 5.


30 minutes to explain programming to a 15 year old

I've been volunteered to sit down and talk about the life and work of a Developer with a 15 year old work experience student next week. The catches are that   * I've got just half an hour, and   * I'll be just one of the people talking to her - other people in different roles in the business will also be running through the elements of their jobs with her throughout the day. What should I cover, and what on earth can I hope to teach her in just half an hour? I assume that she probably has no experience with development or programming.


Why do programming languages, especially C, use curly braces and not square ones?

The definition of "C-Style language" can practically be simplified down to "uses curly braces (`{}`)." Why do we use that particular character (and why not something more reasonable, like `[]`, which doesn't require the shift key at least on US keyboards)? Is there any actual benefit to programmer productivity that comes from these braces, or should new language designers look for alternatives (i.e. the guys behind Python)? Wikipedia tells us that C _uses_ said braces, but not why. A statement in Wikipedia article on the List of C-based programming languages suggests that this syntax element is somewhat special: > Broadly speaking, _C-family languages_ are those that use C-like block > syntax (including _curly braces_ to begin and end the block)...


Store and trigger cron-'like' actions with PHP and (My)SQL

I'm crashing my head over a design decision, and I'm trying to get some more inspiration/hints/tips/.. from other programmers. **What is the goal:** I want to run **one cron** task (php script) every minute. In this script I should check a **database full of schedules** (same syntax as cron jobs) to see if an action should run right now. (An action can be sending out an email, sending out text-message, ..) I don't think it's possible with sql only, so the best is to retrieve all schedules, and check in PHP which one of them should be executed at the given moment. I'll also store the "startFrom" date, to say when this schedule should be triggered first. Any suggestions on this one?


What is a general solution to allow the client to choose the concrete instance of a method output?

What is the general solutions to allow the client to choose the concrete instance of a method output? For example, in the Lucene API the search method receives and modifies the collector input parameter, but this is generally regarded as a bad practice:               IndexReader reader = DirectoryReader.open(index);     IndexSearcher searcher = new IndexSearcher(reader);     TopScoreDocCollector collector = TopScoreDocCollector.create(10, true);     searcher.search(q, collector);     ScoreDoc[] hits = collector.topDocs().scoreDocs;      An alternative would be to provide a Factory as input and have the search method return the instance created. What else?


Developing a simple web-application?

I decided to do a mini-project by myself to help me understand a bit more about developing web applications before starting the new university semester. Using the Java SE and JEE/J2EE platforms. I will be creating a simple web application that will retrieve data from a database and display the data. I decided to use a Model-View-Controller type pattern and so far decided that the: Models: Will be Java objects which are persisted in the database using a framework. View: will only be the front end, probably written in HTML with some CSS. I have not (at a high level) decided how the controller should be implemented, I initially went along with the idea that I will use JDBC to query results from the database and display it to the front end but the use of frameworks should ease the process. I was told that there are some open source frame-works that help in making web application and a few I looked up were Spring and Hibernate. My question then is there a way of incorporating these frameworks to what I proposed and if so how can I learn about these frameworks in order to create a web application? Would appreciate advice and experiences about developing web-applications. This is something I have not done before so it’s all a new and a learning process for me. In essence I want to create is a web-application using Java as the primary programming language in which database querying functionalities help in displaying outputs to the front end. **Edit:** Edited question to make it clearer for those who want to start similar type projects.


Manufacturing vs Software Development

It's often said that the software industry is immature compared to manufacturing. Specifically with regard to being process driven. **Question** : Can we as developers learn from the processes of the manufacturing industry? Can adopting their processes increase the success rate of software development? **My take** : In manufacturing the creation of a product is heavily process driven. You may have a factory where each person has a specific set of tasks they follow. A worker (or robot) may tighten a screw all day long. Then the next task in the process is performed by the next specialist. The workers (and robots) do not deter from the process or make something up "on the fly". The parts churn through the through the process, and the output is a finished product. It works well and companies achieve 99.99966% defect free products. Companies iron out inefficiencies over time. This is impressive and very well may be the sign of a mature industry. In manufacturing a defined process can literally create the finished product. I don't think this is the case in software. We may have processes for source control, code review, check in sheets, requirements gathering, the SDLC, etc. But executing those processes does not in and of itself create a finished product. These processes may be beneficial, but are orthogonal to the actual creation. Suppose your company is contracted to create software that will search millions of images to find the faces of a criminals. Despite the heavy process driven environment, the developer must engage in creating things "on the fly". Doing things on the fly is against the spirit of manufacturing. A good manufacturing process can be executed without thought by a robot. For the creation of complex algorithms which have yet to be fathomed in the mind of a human, it is a necessity to create things on the fly. Software development is not the following of a process, but the creation of a processes to be exucuted by a computer. That is a fundamental difference. No matter how many orthogonal processes we put up around development, we will always resort to doing it "on the fly" when it comes to creation. Everyone I talk to seems to agree with the manufacturing mindset. Am I alone in my thoughts? **Edit** : I have accepted an answer. And my mind is made up. [start lecture] I declare the field of Software Engineering has grossly misunderstood the nature of processes. A process is a set of steps. If something can be expressed as a set of steps, it can be automated (or at least the high level aspects can be applied by rote). Automation cannot perform original creation, therefore all processes are orthogonal to creation. I think our best bet is to come to terms that the processes that we adopt are orthogonal. We can never grow out of our "immaturity". It is the physics of creation that will keep us perceived as immature forever. [/end lecture]


Code structure for multiple applications with a common core

I want to create two applications that will have a lot of common functionality. Basically, one system is a more advanced version of the other system. Let's call them `Simple` and `Advanced`. The `Advanced` system will add to, extend, alter and sometimes replace the functionality of the `Simple` system. For instance, the `Advanced` system will add new classes, add properties and methods to existing `Simple` classes, change the behavior of classes, etc. Initially I was thinking that the `Advanced` classes simply inherited from the `Simple` classes but I can see the functionality diverging quite significantly as development progresses, even while maintaining a core base functionality. For instance, the `Simple` system might have a Project class with a Sponsor property whereas the `Advanced` system has a list of Project.Sponsors. It seems poor practice to inherit from a class and then hide, alter or throw away significant parts of its features. An alternative is just to run two separate code bases and copy the common code between them but that seems inefficient, archaic and fraught with peril. Surely we have moved beyond the days of "copy-and-paste inheritance". Another way to structure it would be to use partial classes and have three projects: `Core` which has the common functionality, `Simple` which extends the `Core` partial classes for the simple system, and `Advanced` which also extends the `Core` partial classes for the advanced system. Plus having three test projects as well for each system. This seems like a cleaner approach. What would be the best way to structure the solution/projects/code to create two versions of a similar system? Let's say I later want to create a third system called `Extreme`, largely based on the `Advanced` system. Do I then create an `AdvancedCore` project which both `Advanced` and `Extreme` extend using partial classes? Is there a better way to do this? If it matters, this is likely to be a C#/MVC system but I'd be happy to do this in any language/framework that is suitable.


Do I lose anything by coding in c# and using free online vb.net code convertors?

The company I work for uses vb.net since there are many programmers who moved up from vb6 to vb.net. Basically more vb.net resources in the company for support/maintenance vs c#. I am a c# coder and was wondering if I could just continue coding in c# and just use the many online free c# to vb.net code convertors. That way, I will be more productive and also be more marketable since there are more c# jobs compared to vb.net jobs. I have done vb6 many years ago and I am comfortable debugging vb.net code. It's just the primary coding language. I am more comfortable in c#. Will I lose anything if I use this approach. (code conversion). Based on what i read online the future of vb.net is really "Dim". Please advise. thank you


Why Browsers do not resolve simple known issues?

Why Browsers do not resolve simple known issues such as: (in the context of CSS) Do NOT start a class name with a number! This is only supported in Internet Explorer and Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.


Is it necessary to discuss database changes

I am working on a project with a team of 4-5 people. Is it necessary to discuss the database changes with the team before implementing? I am working on the database api's. Is it better to discuss this or not? In my team are senior people. So can't I make changes myself and implement the change and explain the changes.


Is it normal for a software developer to have lots of issues after product went live?

In recent months, our product (which went live probably 9 months ago) experience an increase in the number of users using it. We faced lots of queries, problems, and complaints from users. Sadly, it seems that a lot of the issues seem to be coming from a module that I have been working on. At times, I wonder if I am incompetent, or is this pretty normal in software development, that bugs are found especially during the initial stages of a software development livecycle after it goes live? I wonder why some issues we faced now are not foreseen by me or the team during development phase. I have been working as a software developer for close to 2 years now. Hope to get your opinions, feedback, advices! Thanks!


Managing Personal Projects As Solo Developer - Getting out of depth and failing projects

I need some advice on project management. I start a project, and often times it will a large project for a solo developer. Usually its a web project. I handle everything from the UI, to the JS, PHP, server management etc. Half way in I feel out of my depth. I lose where I am, so I spend a couple of days away from the project to avoid the stress and before you know it, it becomes another unfinished project. I try to use frameworks and code libraries to make my developments easier on myself. Sometimes I will complete a project so it "works" and then go back and handle errors, design the UI properly and stuff. But without fail I will always end up out of my depth. I've though about outsourcing tasks such as the UI, and the behaviour, and focusing just on the PHP - which I feel is my strong point. But then pride kicks in, and I don't feel at one with a project I haven't completed myself. Does this make sense? I am sure there are many others who have felt like this either at home, or at work, and I would love some advice on managing my projects better.


Static class vs Singleton class in C#

> **Possible Duplicate:**   >  What is the difference between all-static-methods and applying a singleton > pattern? I need to make a decision for a project I'm working of whether to use static or singleton. After reading an article like this I am inclined to use singleton. What is better to use static class or singleton? Edit 1 : Client Server Desktop Application. Please provide code oriented solutions.


Could a singleton type replace static methods and classes?

> **Possible Duplicate:**   >  What is the difference between all-static-methods and applying a singleton > pattern? In C# Static methods has long served a purpose allowing us to call them without instantiating classes. Only in later year have we became more aware of the problems of using static methods and classes.   * They can’t use interfaces   * They can’t use inheritance    * They are hard to test because you can’t make mocks and stubs Is there a better way ? Obviously we need to be able to access library methods without instantiated classes all the time otherwise our code would become pretty cluttered One possibly solution is to use a new keyword for an old concept: _the singleton_. Singleton’s are global instances of a class, since they are instances we can use them as we would normal classes. In order to make their use nice and practical we'd need some syntactic sugar however Say that the Math class would be of type singleton instead of an actual class. The actual class containing all the default methods for the Math singleton is DefaultMath, which implements the interface IMath. The singleton would be declared as               singleton Math : IMath     {        public Math        {           this = new DefaultMath();        }     }      If we wanted to substitute our own class for all math operations we could make a new class _MyMath_ that inherits _DefaultMath_ , or we could just inherit from the interface IMath and create a whole new Class. To make our class the active Math class, you'd do a simple assignment               Math =  new MyMath();      and voilá! the next time we call Math.Floor it will call your method. Note that for a normal singleton we'd have to write something like Math.Instance.Floor but the compiler eliminates the need for the Instance property Another idea would be to be able to define a singletons as Lazy so they get instantiated only when they're first called, like               lazy singleton Math : IMath      What do you think, would it have been a better solution that static methods and classes? Is there any problems with this approach? **Addendum** Some points have been raised, that one of the main benefits of static methods is having methods that are "stateless" and thus side-effect free to some extent from a concurrency point of view. I wholeheartedly agree that that's a valid point. However we're mixing two different issues and problems here: One is making some methods invokable and globally accessible without having to explicitly create an instance. The other is having methods that are stateless. The second problem could be solved by method having something like a stateless keyword that similarily to static prevented them from calling this or perhaps do even more to enforce no side-effecs. With singletons rather than static classes and something like stateless classes and methods I think you'd have the following pro's and con's **Pro's**   * "Static" methods in other classes and framework classes could easily be designed to be overridable   * Classes would be easier to test   * Using instances instead of static classes means design patterns work better (things like factories)   * No limitation on inheritance and polymorphism in contrast to static  **Cons**   * Perhaps slightly worse performance?   * Bad programmers will but everything in singletons to have them globally accessible instead of using dependency injection, perhaps you should only be able to access singleton methods and not properties/fields to avoid global variables :)   * ? Perhaps Math was a bad example, but imagine if the .Net string methods were inefficient, you could easily replace them with your own using this method. Or some third-party class has has a singleton method that you wanted to alter slightly, you could inherit and alter that method


Patterns to avoid long switch block in UI?

Sometimes you have many entities which have common parts, but also should be addressed uniquely in UI. For example, in a CMS, you have many content types (like news, images, articles, pages, etc.) which have title, URL, SEO settings, etc. in common, but which also have specific fields. For example, image have a path field, while news doesn't have that. Now when you want to work with these items per page, you encounter long `switch` and `if` blocks. For example:               switch(currentLoadedContentType)     {        case ContentType.Gallery:            // Show gallery specific fields;            break;        case ContentType.News:            // Show news specific fields;            break;        case ContentType.Artiel:            // Show artiels specific fields;            break;        case ContentType.Page:            // Show pages specific fields;            break;     }      As you increase the number of content types, this lists gets longer and longer. What patterns are available to reduce the length or eliminate this long switch, but at the same time don't result in repetition. (I'm a big fan of DRY).


Difference between hash and dictionary

What is the difference between Hash and Dictionary. Coming from a scripting background, I feel that they are similar , but wanted to find out the exact differences, Googling did not help me much.


Programming a trading strategy

Excuse me if I'm not descriptive enough, as I do not have much of a background when it comes to these things: How would I go about coding a primitive trading strategy and link it to some sort of artificial trading environment? Where do I start, and what are some other essential questions I should be asking? I am interested more in doing this because it interests me than making returns. Ideally it utilizes random/historical market data and doesn't actually execute any real trades. My background: I'm almost done my undergrad degree in computer science, and have had intro finance and economic courses. Familiar mostly with C and Java.


Is anyone doing "real" TDD with Visual-C++, and if yes, how do they do it?

Test Driven Development implies _writing the test before the code_ and following a certain cycle:   * Write Test   * Check Test (run)   * Write Production Code   * Check Test (run)   * Clean up Production Code   * Check test (run) As far as I'm concerned, this is only possible if your development solution allows you to very quickly switch between the production and test code, and to execute the test for a certain production code part extremely quickly. Now, while there exist lots of Unit Testing Frameworks for C++ (I'm using Bost.Test atm.) it does seem that there _doesn't_ really exist any decent (for _native C++_ ) Visual Studio (Plugin) solution that makes the TDD cycle bearable regardless of framework used. "Bearable" means that it's a one-click action to run a test for a certain cpp file without having to manually set up a separate testing project etc. "Bearable" also means that a simple test starts (linking!) and runs very quickly. So, what tools (plugins) and techniques are out there that make the TDD cycle possible for native C++ development with Visual Studio? Note: I'm fine with free or "commercial" tools. **Please** : **No** framework recommendations. (Unless the framework has a dedicated Visual Studio plugin and you want to recommend the plugin.) * * * Edit **Note** : The answers so far have provided links on how to integrate a Unit Testing framework into Visual Studio. The resources more or less describe how to get the UT framework to compile and get your first Tests running. _This is **not** what this question is about._ I'm of the opinion that to really work productively, having the Unit Tests in a manually maintained(!), separate vcproj from your production classes will add so much overhead that TDD "isn't possible". As far as I am aware, you do _not_ add extra "projects" to a Java or C# thing to enable Unit Tests and TDD, and for a good reason. This _should_ be possible with C++ given the right tools, but it seems (this question is about) that there are very little tools for TDD/C++/VS. * * * Googling around, I've found one tool, VisualAssert, that seems to aim in the right direction. However, afaiks, it doesn't seem to be in widespread use (compared to CppUnit, Boost.Test etc.). * * * Edit: I would like to add a comment to the context for this question. I think it does a good summary of outlining (part of) the problem: (comment by Billy ONeal) > Visual Studio does not use "build scripts" that are reasonably editable by > the user. One project produces one binary. Moreover, Java has the property > that Java never builds a complete binary -- the binary you build is just a > ZIP of the class files. Therefore it's possible to compile separately then > JAR together manually (using e.g. 7z). C++ and C# both actually link their > binaries, so generally speaking you can't write a script like that. The > closest you can get is to compile everything separately and then do two > linkings (one for production, one for testing).


Is this an acceptable approach to undo/redo in Python?

I'm making an application (wxPython) to process some data from Excel documents. I want the user to be able to undo and redo actions, even gigantic actions like processing the contents of 10 000 cells simultaneously. I Googled the topic, and all the solutions I could find involves a lot of black magic or is overly complicated. Here is how I imagine my simple undo/redo scheme. I write two classes - one called `ActionStack` and an abstract one called `Action`. Every "undoable" operation must be a subclass of `Action` and define the methods `do` and `undo`. The `Action` subclass is passed the instance of the "document", or data model, and is responsible for committing the operation and remembering how to undo the change. Now, every document is associated with an instance of the `ActionStack`. The `ActionStack` maintains a stack of actions (surprise!). Every time actions are undone and new actions are performed, all undone actions are removed for ever. The `ActionStack` will also automatically remove the oldest `Action` when the stack reaches the configurable maximum amount. I imagine the workflow would produce code looking something like this:               class TableDocument(object):         def __init__(self, table):             self.table = table             self.action_stack = ActionStack(history_limit=50)              # ...              def delete_cells(self, cells):             self.action_stack.push(                 DeleteAction(self, cells)             )              def add_column(self, index, name=''):             self.action_stack.push(                 AddColumnAction(self, index, name)             )              # ...              def undo(self, count=1):             self.action_stack.undo(count)              def redo(self, count=1):             self.action_stack.redo(count)      Given that none of the methods I've found are this simple, I thought I'd get the experts' opinion before I go ahead with this plan. More specifically, what I'm wondering about is - are there any glaring holes in this plan that I'm not seeing?


Application Logic – which of the two definitions is correct?

This is my understanding of the _Application Layer_ : • It implements _Application logic_ • this layer contains _Application Services_ , which are used by external consumers to talk to your application • _Application Services_ are coarse-grained and orchestrate operations which map directly to _use cases_ ( hence also the term _Workflow Services_ ) 1)   From: > Application Logic is mostly workflow logic. It is the application specific > coordination of domain and infrastructure components according to the > requirements of that particular application. From: > Let's start a company, shall we? Sapient Grey will be primarily a think > tank, but with an in-house development group with the capabilities to make > the visions of the core committee a reality. Our corporate motto, "Sapient > Grey is People..." will be burnished in giant brazen letters alongside a > customized version of Rodin's famous sculpture "The Thinker", all of which > will adorn the east-facing side of our brand new ten story red granite > office building.... Oh, wait. We don't have an office building yet. Okay > then, so we'll hire an architect to design our office building, being sure > to include a private elevator and an elaborate zen-style atrium or courtyard > in the center. In the meantime, while the building is being designed and > constructed, you and I and our other elite colleagues will fly ourselves to > Tahiti to brainstorm Sapient Grey's visions, goals, agenda, and lay out a > detailed business plan. > > Our architect is creating detailed blueprints for the office building, > figuring out how the plumbing will need to be laid out, how the electrical > systems will be segregated and tied together, how the interoffice > communication system will be organized, and how we will implement security > at all levels. The systems and designs that our building architect is > handling is a precise analogy to what "Application Logic" is within a web > application. How security is implemented, how we will manage and access > state and persistence, how we will handle storage and retrieval of > data....this is application logic. Like our office building, which when > complete could house and accommodate anything from an elite night club to an > investment firm, the application logic is independent of the actual business > logic that executes within it. a) The above quotes are two different definitions of the term _Application Logic_ and as such it appears they just happen to use the same term (ie _Application logic_ ) to describe two different concepts. Thus, does only the the first definition describe the logic contained in _Application layer_ , while the latter definition is describing a different kind of logic? b) If indeed both definitions describe the logic in _Application layer_ , then wouldn't this mean that _Application layer_ performs two tasks: orchestrating operations that map directly to _use cases_ and executing non-business related logic (such as security, caching etc)?


Modelling Betting Markets

I've got some general questions about modelling a series of betting markets and bets within them. I'm writing in Ruby but it's ultimately agnostic towards which language I want to use. I have a concept of "games", for example, a soccer league. While the league is running, people can place various types of bets. A bet might be the winner of the league, or it might be the top three winners in any order. Or the top three winners in order. This is called a "market". Within a game I also have participants. These are the teams that make up the league. A bet consists of one or multiple participants, the order of these participants is important plus an amount. It is stored against the market. My question is how should I got about organising this? At the moment I have market types (say Win) inheriting off a base market class. The base class I'm using looks like this:               class Base         def self.make(game, market_name)             puts Kernel.const_get("MatchMaker::Markets::#{market_name}")         end     end      The make function is a factory method for generating win classes based on a string passed in with the name off the bet type. This generation seems a bit clunky at the moment, and I'm somewhat concerned that it might cause me further problems down the track. I realise this question is somewhat rambling and doesn't have a clear answer. I'm interested more in other peoples ideas in how they would go about putting something like this together.


Designing a Web Application with Two Different Backend Databases

I'm working on a pretty standard LAMP based web application. The server itself has a standard MySQL database and the application is written in PHP. The kicker is, we also use SQL Server databases with this application. ## The current data setup is this:   * MySQL stores the user account information (Username, password, privileges, etc.) and a "connection identifier".   * The connection identifier links to another table that stores connection credentials for a SQL server database.   * When a user logs in, a connection is made to a remote SQL Server database (these are hosted independently of the web application and not in my control).   * Using that connection, the web application processes and outputs the data (only reads, no writes). The application has evolved greatly and, while the organization and practices have improved, the design is still pretty messy and confusing. I struggle to implement any kind of framework or ORM because most are designed with one database in mind. I have stitched together a framework that works very well for reports (where only the SQL Server connection is needed) but it doesn't go well with things like account interaction (where SQL server is used for validation of data that goes into MySQL). The setup doesn't look like it will change so I was wondering if there was any advice on designing and maintaining a web application with two different database backends at the same time. On a side note, storing the credentials for remote SQL Server databases on our MySQL database makes me nervous. I can only encrypt the passwords as I need them for connections and, as it currently stands, all the accounts used are admin accounts with full privileges. Not something you want getting out especially when these databases are opened up for internet connections. So any advice for that would be nice as well.


Choosing value in SQL query vs (Java) code

I need to choose one of three values of an integer using the value of a column on a nullable column of a table. There are at least two approaches: 1) use SQL to do all the work: test null values, and choose between the other values, or 2) read the value and use code -in this case Java- to choose. Which one is "better", ie. easier to understand & more maintainable? Do you have any other metric use to decide? As an example, I have the following code:               // If id is equal to:     //   -1, then make v = 1     //   null, then make v = 2     //   in any other case, make v = 3          // Option 1:     int v;     String query = "SELECT CASE min(Id) WHEN NULL THEN 2 WHEN -1 THEN 1 ELSE 3 END AS Id"             + "FROM TableA WHERE SomeField IN (SELECT ...blah blah...)";     ResultSet rs = // execute query     if (rs.next()) {         v = rs.getInt("Id");     } else {         // TODO something went *very* wrong...     }          // Option 2:     int v;     String query = "SELECT CASE min(Id) Id"             + "FROM TableA WHERE SomeField IN (SELECT ...blah blah...)";     ResultSet rs = // execute query     if (rs.next()) {         final int id = rs.getInt("Id");         if (rs.wasNull()) {             v = 2;         } else if (id == -1) {             v = 1;         } else {             v = 3;         }     } else {         // TODO something went *very* wrong...     }


How to provide a custom ID to a downloadable application?

I've noticed that with remote support services, a technician usually sends you a download link to an executable. When you click on that link, it installs a software which automatically connects with the remote technician and allows him/her to access your computer. Basically, what's happening is that somehow the installed application has a session ID which it's using to identify and connect with the technician. How is that session ID passed onto the downloaded application? Is a custom executable compiled/generated for each session and the executable has that session ID embedded within it's resources? any other method of achieving the same?


GPLv3 code in non-GPL software -- linking vs. CLI

Suppose there's a GPLv3 app that has a GUI and a CLI. Can I legally expand its CLI (to give me access to functionality hitherto only available via the app's API), release the result under GPL and then create a non-GPL (perhaps proprietary) app that depends on this modified GPL app (via the expanded CLI)?


Deprecate a web API: Best Practices?

Eventually you need to depreciate parts of your public web API. However I'm confused on what would be the best way to do it. If you have a large 3rd party app base just yanking old versions of the API seems like the wrong way to do it as almost all apps would fail overnight. However you can't keep ancient web api's available forever as it might be outdated or there are significant changes that make working with it impossible. What are some best practices for deprecating old web api's?


Task Consumer/Processor architecture

**PROBLEM** We have various tasks in our system which can take up to 20 minutes. These tasks are generally started from the web interface and run on a new thread. This is obviously a terrible solution because the task could be recycled by IIS and it hogs up precious resources on the web server. **POSSIBLE SOLUTION** Hosting a `TaskConsumer` class in a windows service (or Azure Worker Role, in our case), which picks up tasks and processes them. This would handle the queuing and running of tasks. New tasks are added to a database table (say `Tasks`) in the client code via some `TaskManager` class (`TaskManager.Enqueue(ITaskable)`), which are then picked up by the `TaskConsumer` (perhaps it is polling this table for additions?). This table would also be updated by the `TaskConsumer` while the task is executing (perhaps a state field - `RUNNING`, `QUEUED`, `FAILED`, `COMPLETE`). To create a new type of task, one would implement an `ITaskable` interface. This would demand implementations for a `Process()` method, which would contains the logic to run that task. A UI interface could show all active tasks and perhaps provide some management capabilities (e.g. cancel a task, restart a task, etc). This info can be retrieved from the `TaskManager` class (`TaskManager.ActiveTasks`), which essentially is reading from the `Task` database table. The `ITaskable` concrete implementations would need to have serializable properties so to be stored in the database. This is neede because there would be specific parameters/data needed to run the task. For example, an `ImportEmployees` task would need to have the name of the file which was originally uploaded. This would need to be known at the time the consumer needs to execute the task (on desialization). ![Architecture](http://i.stack.imgur.com/HSTYi.png) **Is this a good approach to tackle this problem?** I am sure there must be many patterns out there for this kind of problem.


Attributes of an Ethical Programmer?

Software that we write has ramifications in the real world. If not, it wouldn't be very useful. Thus, it has the potential to sweep across the world faster than a deadly manmade virus or to affect society every bit as much as genetic manipulation. Maybe we can't see how right now, but in the future our code will have ever-greater potential for harm or good. Of course, there's the issue of hacking. That's clearly a crime. Or is it that clear? Isn't hacking acceptable for our government in the event of national security? What about for other governments? Cases of life-and-death emergency? Tracking down deadbeat parents? Screening the genetic profile of job candidates? Where is the line drawn? Who decides? Do programmers have responsibility for how their code is used? What if a programmer writes code to pry into confidential information or copy-protected material? Does he bear responsibility along with the person who used the program? What about a programmer who knowingly or unknowingly writes code to "fix the books?" Should he be liable?


What are the pros and cons of Coffeescript?

Of course one big pro is the amount of syntactic sugar leading to shorter code in a lot of cases. On http://jashkenas.github.com/coffee-script/ there are impressive examples. On the other hand I have doubts that these examples represent code of complex real world applications. In my code for instance I never add functions to bare objects but rather to their prototypes. Moreover the prototype feature is hidden from the user, suggesting classical OOP rather than idiomatic Javascript. The array comprehension example would look in my code probably like this:               cubes = $.map(list, math.cube); // which is 8 characters less using jQuery...


How to gain Professional Experience in Java/Java EE Development

I have been seeing opportunities go past me for just 1 reason: not having professional industry experience. I say to many employers that I'm capable of doing the job and show them the work I've done during the academics and also several personal projects which I took extra time and effort to teach myself the new industry standard technologies. But still, all they want is some 2-3 years experience in an industry. I'm a recent graduate with a Master's Degree in Computer science. I've been applying for quite a few jobs and most of these jobs require 2 years minimum experience. So, I thought somebody here might give me some realistic ideas about getting some experience which can be considered professional. Any kind of constructive comments are welcome.


Application that provides unique keys to multiple processes

Any idea on how to build an application that provides unique keys each time it get called by another process.   Calling process isn't my problem here, my problem is how to sync between two(or more) processes and preventing it from providing the same key to both of them. I'd really appreciate your help in this issue, please only outline the solution and I'll try to implement it.


Do we need to adopt a black-box asset our project is inheriting from its predecessor?

Our client has an eCommerce site which was developed by an in-house team, and is now showing its age. I work for a firm brought in as external contractors to build a replacement. Part of the current site is a Flash viewer applet which displays media about the product - zoom-able images, 360-degree views, movies, and so on. We need to show the same media the current site does, so we are simply reusing the viewer. The viewer is embedded on a page in the usual way, and told what media to show by means of an XML file it loads from our server, which is pretty simple for us to generate. We've got this working; it was pretty straightforward. But what else do we need to do? The thing is, as far as we're concerned, the viewer is a binary blob which is served from the client's content-distribution network. We embed it, feed it some XML, and it does its job, but we have no power over its internals. It's completely opaque to us - a black box. We can use it to do what it does, but we can't change it, so if we ever need to do something different, we're stuffed. We're building this site for the client, and when we're done, we'll hand it over for them to maintain. We won't be doing the maintenance ourselves. There's a small team within the client who are working as part of our team, and who will be the ones doing the maintenance. That team only includes one person from the team that built the old site, and it's not someone who knows the image viewer. The people who do know the image viewer are not slated to join our team when our system replaces theirs - they'll be moved to other projects. The documentation on the viewer is extremely thin, and as far as i know doesn't cover the internals at all. My worry is that if someone doesn't take some positive action, all knowledge of the internal workings of the viewer - even down to where the source code for it is - will be lost. It's possible it already has been. Is this something to worry about? If so, whose job is it to worry about it? What should they do about it once they've got worried?


The most mind-bending programming language?

From a _reasonably_ common programming language, which do you find to be the most mind-bending? I have been listening to a lot of programming podcasts and taking some time to learn some new languages that are being considered upcoming, and important. I'm not necessarily talking about BrainFuck, but which language would you consider to be one that challenges the common programming paradigms? For me, I did some functional and logic (for example, Prolog) programming in the 1990s, so I can't say that I find anything special there. I am _far_ from being an expert in it, but even today the most mind-bending programming language for me is Perl. Not because _"Hello World"_ is hard to implement, but rather there is so much lexical flexibility that some of the hardest solutions can be decomposed so poetically that I have to walk outside away from my terminal to clear my head. I'm not saying I'd likely sell a commercial software implementation, just that there is a distinct reason Perl is so (in)famous. Just look at the basic list of books on it. So, **what is your mind-bending language that promotes your better programming and practices**?


Pattern for costly precondition check before acting

Let's say I have a method `DoTheThing()` which requires the precondition-check `CanTheThingBeDone()` to return true. The latter method is time consuming as it accesses the database. I'm finding it hard to find a perfect way to perform the precondition check effectively (i.e. _once_ ) while maintaining both readability and API integrity. Observe these examples: **Example 1:**               class System() {         public void DoTheThing() {             if (!CanTheThingBeDone()) throw new Exception(...);             // Do it         }              public bool CanTheThingBeDone() {             // Some time consuming code         }     }          class Consumer() {         public void SomeLargerOperation() {             try {                   system.DoTheThing();             }              catch (Exception) {                  // Error handling             }         }     }      **Example 2:**               class System() {         public void DoTheThing() {             // Do it         }              public bool CanTheThingBeDone() {             // Some time consuming code         }     }          class Consumer() {         public void SomeLargerOperation() {             if (system.CanTheThingBeDone()) {                  system.DoIt();             }         }     }      Both approaches are ok, but both have drawbacks. In _Example 1_ , I'm forcing the consumer to wrap the code in a try-catch for faulty states. These states can be user-triggered so some graceful handling is required. I'm unsure if try-catch for handling user-errors is a good approach. In _Example 2_ I'm handing the responsibility of state-checking over to the consumer, opening up for non-descriptive runtime errors. In _this_ example, CanTheThingBeDone() is checked, but when Jimmy enters the team 1 year from now to develop module 2, that might change. **Example 3:**               class System() {         public bool DoTheThing() {             if (!CanTheThingBeDone()) return false;             // Do it              return true;         }              public bool CanTheThingBeDone() {             // Some time consuming code         }     }          class Consumer() {         public void SomeLargerOperation() {             if (!system.DoTheThing()) ProduceSomeErrorMessage();         }     }      Now in this example, I avoid try-catch for user errors and prevent the actual Do-code to be executed if invalid state, while ensuring the check-code is run only once. But I feel I'm breaking some naming/coding principle when the method is both performing check and modifying class state (I'm pretty sure it even has a name). As a fourth example, I could envision a combination of #1 & #2 where both the consumer and `DoTheThing` calls `CanTheThingBeDone`, but then we're doing the work twice. To sum up - I can't seem to find a best approach. Anyone have a better idea than mine, or suggestions on how to tweak one of these approaches for a better result?


Fail-fast paradigm overheads

Fail-fast seems like a right way since it simplifies bug detection. But it's a harm for performance cause of multiple checking the same thing at several levels of the system. Simple example. There is a function that input parameters must be not null. And there is function wrapping it, that also await the same parameters also not null. After some activities function-wrapper passes input parameters into first one. So that the same items checked two times: at the beginning of function wrapper and inside wrapped function. So I would like to know how much widespread this style is. Should I write fail-fast code or check everything just once?


Commit projects individually or whole solution?

I am working (alone) on an application that is a music portal where you can search for artists, songs etc ... The C# solution consists of:   * a class library that contains all the stuff to access the web service   * the application itself I've recently started using Git and figured out the benefits it does provide to a project but there's something I couldn't figure out, on Visual Studio there is the option to commit a solution which leads me to the following question : Should I commit each project individually or the whole solution ?


What is an Anti-Corruption layer, and how is it used?

I'm trying to figure out what the Anti-Corruption layer really means. I know that it's a way to transition/work around legacy code or bad APIs. What I don't understand is how it works and what makes it a clean separation from the undesirable layer. I've done some searching, but I can't find any simple examples or explanations, so I'm looking for someone who understands it and can explain it with simple examples. An answer that would satisfy my question should be simple (not necessarily short), and provide understandable examples of implementation and use. See this question, for my use case.


C# Logic - gaps & Islands

I am looking for help designing the display of available times for appointments (for example a hairdresser's appointment book). Currently I have a query that returns a collection of periods that are unavailable for appointments (whether there is an existing appointment or if the service provider is closed). So lets say Feb 3rd, from 12 to 5 is unavailable, i want to output the following string: Jan 1st 12 am - Feb 3rd 12pm Feb 3rd, 5pm - Dec 31 12 am. My entire range is 1 year from Jan 1st to December 31st and there can be as many unavailable dates.


Multiple Dispatch and CLOS

I have never written software in Common Lisp, but in Scheme and Clojure as well as C++ and Python. Yet I have had a look at the Common Lisp Object System (CLOS) in Common Lisp and Dylan. Now when comparing it to OOP in the Simula tradition, CLOS and lets say C++ and Python class system have polymorphism as a common trait. They seem to differ in the way how data and methods are organized, in the Simula family, methods are an integral part of classes, sub-items if you will while with CLOS they are defined outside of classes and are rather generalized procedures. Common Lisp proponents typically argue that virtual methods in Simula-family programming languages are quite limited since they are invoked only according to the first-argument object (`this` or `self`). CLOS generic functions are selected for several arguments, thus something like (pseudo code)               method draw(c : Device, d : Drawable) ...       can be implemented for arbitrary `Canvas` and `Drawable` combinations.               method draw(c : Printer, t : Triangle)....     method draw(c : Printer, t : Image)....     method draw(c : Screen, t : Image) ....      In Simula-family languages, this would be more difficult, since `draw` would have to be associated with either the `Device` or the `Drawable` family of objects. The canonical solution seems to be the Visitor Pattern http://en.wikipedia.org/wiki/Visitor_Pattern . Upon learning CLOS, I was quite amazed that most OO programming languages do not offer multiple dispatch - and - wondered if there are specific reasons, why one might associate methods so closely with one specific class. **Are there specific advantages for single dispatch?**   * ambiguity of multiple dispatch: i.e. lets say I have `a` subclassing `A` and `b` subclassing `B`. The method `foo(A,B)` implemented as `foo(a,B)` and `foo(A,b)`, which implementation would a call of `foo(a,b)` invoke? Is this the only reason?   * "Modularizing", methods in the class are near. Is there more to it? Have language designers and creators taken a stance on this matter?


How best to look up objects by label?

I am writing the server backed by a pre-written API. I'm going to get a number of strings representing ports, signals, paths, etc etc etc. I need to look up the object associated with a given label, these objects are all in memory (no sql magic to do this for me). My question is, how best do I associate a given unique label with the mutable object it represents? I have enough objects that looking through every signal or every port to find the one that matches is possible, but may be slightly too slow. To be honest the direct 'look at every object' method is probably good enough for so small a body of objects and anything else is premature optimization, but I still am curious what the proper solution would be if I thought my signals were going to grow a bit larger. As I see it there are two options available. First would be to to create a 'store' that is a simple map between object and label. I could have it so that every time I call `addObject` the object is automatically saved into a hashmap or the like. This works, but relies on my properly adding _and deleting_ each object so the map doesn't grow indefinitely. The biggest issue to me is that this involves having some hidden static map in my ModelObject class that just feels...wrong somehow. The other option is to have some method that can interpret the labels. All of these labels are derived from the underlying objects. So I can look at the signal label, for instance, and say "these 20 characters are the port" to figure out what port I need. This would allow me to quickly figure out what I need. However, if the label method is changed the `translateLabelToObject` method needs to be updated as well or everything breaks. Which solution is cleaner, or possibly a cleaner solution than either of above? For the record I'm working with sufficient number of variables to make direct comparison a little slow, but not enough to be concerned about memory overhead, written in java. All objects that have labels I need to look up extend the same parent class.


How can I find contract Android work?

Two years ago, following 15+ years in Win32 and SymbianOS, I decided to intensively focus on Android. I took the best part of 2009 off work to learn the new platform thoroughly, and that seems to have been a good strategic decision: Android is everywhere now. But it seems strangely hard to find Android development work. I have this nagging feeling that there must be some website, some secret society or labour exchange, that has somehow eluded me. What's going on? If you're an Android contractor, how did you find your current work?


Is it possible to know what programming language a web-site uses?

For example, `stackexchange.com`, without asking the site owner or Google their information about developing the website, is this possible to know what language is used in the back end? Seems, the website don't have `.extension` bar, for example `.php` that can indicated which is developed in `PHP`, but without the extension, how can I know that?


Are super methods in JavaScript limited to functional inheritance, as per Crockford's book?

In Douglas Crockford's "JavaScript: The Good Parts", he walks through three types of inheritance: classical, prototypal, and functional. In the part on functional inheritance he writes: > "The functional pattern also gives us a way to deal with super methods." He then goes on to implement a method named "superior" on all Objects. However, in the way he uses the superior method, it just looks like he is copying the method on the super object for later use:               // crockford's code:     var coolcat = function(spec) {         var that = cat(spec),             super_get_name = that.superior('get_name');         that.get_name = function (n) {             return 'like ' + super_get_name() + ' baby';         };         return that;     };      The original `get_name` method is copied to `super_get_name`. I don't get what's so special about functional inheritance that makes this possible. Can't you do this with classical or prototypal inheritance? What's the difference between the code above and the code below:               var CoolCat = function(name) {         this.name = name;     }          CoolCat.prototype = new Cat();          CoolCat.prototype.super_get_name = CoolCat.prototype.get_name;     CoolCat.prototype.get_name = function (n) {         return 'like ' + this.super_get_name() + ' baby';     };      Doesn't this second example provide access to "super methods" too?


Load testing : how to generate per second requests?

I have a server component which runs over Zeroc-ICE. When I wanted to load test it, I thought that using parallel library to create multiple requests would do it. But it dint end up that way. **Using Parallel(Parallel.For)** library from C# apparently was easier but it doesn't seem to be exactly generating everything parallel in the same instant. So it cannot be the definition for creating N requests per second. How should I do it ? I guess anyone who wants to do load testing first would actually think about this .   1. What's the efficient way to actually create N requests in really per second ?    2. Another myth is about the parallel programming. Please enlighten us , if you have used parallel programming patterns in C# or .Net in general . Imagine I have 5 processes. How will start all the five processes at the same time. What does it mean to my consumption of resources ? I have tried reading into many of the material available over the net but I get more and more questions than them being the answer to my questions.   3. I used Parallel.For and created N threads and measured time. Then I tried the same thing using Task.Factory.start for enumeration of tasks. The time measured was different. So What exactly is the different between using these ? When I should use the corresponding classes and for what purposes exactly ? we often have lots of riches but its just we exactly don't know how to differentiate one from the another. This is one such case for me, not being able to find why I should not use one from the another.   4. I used the stopwatch class to measure these times which claims to be the best. In the scenario of me load testing a component, what would be the way to measure the time of response. Stopwatch seems to be the best solution for me . Any opinions are welcome. ps: There are many load testing tools for web applications. Mine is a customised case of server components. And my question is more pertaining to creating N threads per second. **All opinions are welcome. Just don't think its so much not a programming question. It ofcourse is. It should ring bells for any programmer who wants to QE stuff by himself to know the performance of his product , first hand by himself.I have tried many options and then had to fall back on how should I actually do it ?**


What is 'code skew'?

In the O'Reilly book on Scala, I read that copy-pasting of code creates: > ... creates issues of code-bloat, maintainability and _skew_ , I can't see any obvious definitions of the word skew in context. I am aware of the problems of copy-pasting, but I can't make them fit with the word 'skew'. Since this is used in an O'Reilly book I'm guessing it's a real programming term in circulation. Any pointers?


Developed a web site - How to explain in an interview

I developed a e-commerce site for a major company. I did not create some kind of a document to show how the data flows between pages. I used: PHP, HTML, CSS, JavaScript, ExpressionEngine, plugins Modules and some other web technologies When I go to an interview I want to show my site and explain how it works and how I developed the site. Usually I go page by page and explain how the site works. Is there a nice creative way to explain how the site works?


Handle invalid text on server or fix on client in Client-Server application

I have developed a protocol for a Client-Server application and developed it in conjunction with another developer. The client application at this moment is written for the mobile phone. The protocol uses comma separated fields with start and end deliminators. Because some of our fields are free form ASCII text we are byte stuffing the fields so that special characters can be handled within and not mess up our data parsing. The problem is that one field has been byte stuffed when it shouldn't have been. The field in question was to represent coordinates i.e.                   <rest of data packet>, <lat>,<lng>,....          where      <lat>:   Latitude coordiantes i.e. -37.6543     <lng>:   Longtitude i.e. 90.8993      However what we I recieved on the server was the byte stuffed character for a comma appearing in the **dot** field i.e. **-37^-6543.** This in turn caused the server to ignore the packet and not record the details. **Reason** : When I mentioned this to the phone developer he said it was because the character settings on the phone meant that the user had changed the dot to a comma. It was his belief that we should handle this on the server. However I'm not sure. I have a thought that clients should follow the protocol as in theory there could be different clients connecting and the server doesn't want to have special cases littered in it's code base? **Question** : So some options I see are (and I'm not sure how to approach this):   1. Get all clients to send the data as per for the protocol spec and keep the data format black and white so to speak   2. Have the server handle a variety of options in this case   3. In conjunction with 2 adjust the protocol document so that data is more flexible in some cases and the server is responsible for handling the different cases


During software development, which development phase matters most to the programmer?

What does a programmer need to pay attention to during the development of software? For example, some software can not be finished within the time constraints, others cannot meet the requirements of clients.


Software license for commercial/free software

I am building software in PHP right now which will be released with a free version and several premium versions. I'd like a license which allows people to freely modify the code, but not to redistribute it, or include it in proprietary software or any other software without a license. Would the MIT license be best?


Use Queue<T> or stick to native f# lists

I need something that represents a queue in F#. The queue will be filled with items once, and (as the application progresses) items will be taken from this queue and moved to other lists. Should I use the Queue class in .NET, or should I avoid it, and use the native lists in F# instead? Is there a better solution? Why should I use one, or the other, in a functional language such as F#?


How to test the same software on all products in a product line?

In my team we have been working on a firmware for a product. The product was released some years ago but we still implement new features in the firmware and regularly provide a new firmware for our customers. Recently we have developed a new product which use the same firmware as the first one. Of course, we had to change the firmware to allow for some new capabilities (while still keeping functionality for existing product intact). We have a release test specification which contans mostly manual tests which we carry out before we release any new software. We have adapted this for the new product since it has additional capabilities. But most of it is common. I know that new products are in the pipeline and in my simplistic reasoning we need to repeat our release test for each product every time we release a firmware. So i am looking for a new approach which is less time consuming. One of the things we are already working on is automation, but due to the nature of the product many tests _have_ to be manual.


Optimizing web applications

What are the things we need to take care for a web application to handle large number of requests(say 10000 simultaneous requests). Increasing the number of servers and distributing the load is one way , but are there other ways or configurations that can be done on application server ?


What are the differences between throwaway and evolutionary prototypes?

I have notes about various methods of prototyping, and I found several definitions on the Internet, but I would like to confirm what I learned. I understand that **throwaway prototyping** is developed from an outline of a specification, an various prototypes are delivered and modified until the client is satisfied with its functionality. On the other and, **evolutionary prototypes** are built from basic requirements gathered from end-users. An initial prototype is presented to the users and evaluated. The prototype is modified based on the feedback until the client is satisfied. Is this correct? Are there better definitions of throwaway and evolutionary prototyping?


Should experimental code be preserved?

Am am working on a small project for a USB device firmware. I started from a working example, and am gradually adding new functionality and testing things. However, the new functionality is not all intended to be used in the final project. I am writing it to learn how to do things on this concrete platform, and fixing unexpected problems in the process (for example, on of my test PCs had non-functional USB ports). What should I do with the old code? The code is version controlled, of course. I see two possibilities:   * Change old code into new one. An example here would be, when moving from having a Loopback over the UART (for testing purposes), and moving to more sensible use of the UART, change the DMA code to read not from the input of the UART, but from the CPU buffer, that is to be sent out.   * Use a bunch of `#if` statements to make the source code configurable, so that any version of the code can be compiled by only providing the correct `#define`. If the latter approach is recommended, where is the dividing line? I can't keep _every_ line of code that I write, hiding it behind an `#if`.


Constants in C#

Why does the compiler store constant values in the assembly metadata? Are they directly embedded to Intermediate Language code from the assembly metadata?


Should I Use an ORM only when dealing with Data Model objects?

I am new to ORM, and we started developing a new system using NHibernate as the ORM. I think this question may refer to any ORM and any language/platform. The Team Leader has said we should use NHibernate only when retrieving our domain data model objects, ie, not to use any of the built in NHibernate selection or aggregations that will retrieve single primitives or a list of primitives. The reason behind it was that we need to make a distinction between classic ORM and other abilities, so that usual select and select max will use a "classic" DAL project. I think this is not so good, because we break the data access to two, and what's wrong using NHibernate abilities which gets checked compile time? **Are there any reasons to making this distinction?**


Recommended reading for (Object Oriented) application design architecture?

> **Possible Duplicate:**   >  Best books on the theory and practice of software architecture? In life it doesnt matter if you do one thing for 15 years. You **will** end up waking one day and asking stuff that are equal to "how do i walk?" :) My specific question is that as a new entrant to C# and OOP i am stepping into many little "details" that need to be addressed. Written a lot of code in VB.NET / cobol / simple php e.t.c surely does not help much into the OOP world... So , even after reading entry level books for C# and watching some videos i recently found out about the "factory model design" for applications. I would appreciate if any of you guys recomment some reading on application design architecture for further reading...


How to approach the creation of a "Unit Outline" generator?

I am the Studies Coordinator at a College and we currently have somewhere in the order of 100-200 unit outlines that are created at the beginning of each semester. Those outlines need to have information like:   1. Unit Name   2. Unit Code   3. Course Type   4. Assessment Item 1 Name   5. Assessment Item 1 Distribution date... And the list goes on and on. All up there are anywhere between 50-150 pieces of data that teachers enter into their outlines depending on the 10-20 different types of outline they might be creating. Currently we have staff entering data into one of many different Word documents with editable fields. This works okay, but every time the outlines need to have a change made, you can imagine the work involved. The outlines also look poor because different table rows move across different pages...it's just messy. We have tried using InfoPath files...maintaining those was a nightmare and the school won't go back to that. I am contemplating a solution where teachers enter the unformatted/raw data into some kind of front-end (I was thinking an Excel file) and then I write a program that sweeps through the data and generates outlines for me. I've been experimenting with simply using Mail Merge but this doesn't give me the flexibility to tailor the end result based on the data coming in (different numbers of Assessment Items for instance) I know how to work with quite a lot of languages and technologies and am willing to use this as a project into something I might be unfamiliar with but I was looking for advice on ways to approach this so that I can streamline the whole Unit Outline process. Any ideas would be much appreciated.


How do you normally layout a class's regions?

I was wondering if there was a standard for laying out a class's regions. I currently use               Fields     Constructor     Properties     Public Methods     Private Methods      `Fields` being Private Properties and `Properties` being the public ones. I'll normally use subregions within that if needed, or will occasionally add other regions below (such as interface or baseClass members).


Why is Web SQL database deprecated?

I am making a hybrid Android app. At first I decided to use localStorage, after spending 2 days, I realized that it is very strange and so dropped it. Then, I picked up indexedDB, after spending today's whole day and actually getting the output in Google Chrome, it is not running inside a WebView of the android app. And I never used Web SQL database at all because it was deprecated. Anyhow, it has come to my notice that PhoneGap still uses Web SQL and android's browsers support it. Why was Web SQL deprecated in the first place? And will it be a good idea for me to go with Web SQL now?


Why aren't extension methods being used more extensively in .NET BCL?

I found the "Extension method" concept of C# just wonderful. It enables us to do things like:   * More flexible alternative to Abstract Classes.   * Provide missing Java-like functionalities to C# `enum`. And The coolest thing about it IMHO is that **adding a method doesn't break backward compatibility**. However, I found almost no extension methods in the .NET BCL. And it's very common that, I see a static method and extension methods come in mind. When the BCL was designed, extension methods were not there. But why are they not converted to extension methods now? Specially when it does break backward compatibility? Any reasons?


Scrum: Short VS long sprint

We were trying to figure out the optimal sprint length for our project. After working on a 3-weeks basis we thought that cutting the sprint to 2-weeks would provide better velocity. The advantages were clear - shorter feedback loop, small stories (with user value) and so on. On the other hand, there are a lot of disadvantages such as ceremonies (planning, retrospective) and so on in which we don't produce and now happen more often. I was wondering how, for a new team, can we decide on optimal sprint length?


Heap overflow vs stack overflow

So as a general rule to avoid a stack overflow, big objects should be allocated to the heap (correct me if I am wrong). But, since the heap and the stack expand towards each other, wouldn't this cause heap overflow or alternatively limit the space for the stack and higher the chances of stack overflow?