How to be a successful programmer without a CS degree

### Disclaimers (Please read before jumping to answer): I've seen a number of questions similar to the one I would like to ask, so here are some _similar_ questions. IMHO They are neither completely what I'm asking, nor are they as thorough as I hope to be (I don't mean to brush off the answers to the below questions, nor am I discrediting the askers, I just want to be a little more thorough): > Can a CS degree benefit an older programmer? > > Importance of certifications for Java programmer without BS degree? > > In the absense of a CS degree, how can I "fill in the gaps" so to speak? > > Importance of CS degree when applying for development jobs? ### Let me be clear, I'm not asking the following:   * How to teach myself programming from scratch (without a degree in CS)   * How to market myself as a good software developer (without a degree in CS)   * How to get a great high paying job as a software developer (without a degree in CS) ### A little context: Now that I have disclaimers out of the way, let me flesh out my question, starting with a brief history of my experience as a software developer. First off, I have been incredibly lucky. I've been given several job opportunities (a couple heavy backend PHP/MySQL projects, and several WP7 apps in XAML/C#) through which I really learned everything I know about software development. Nearly all of the software development jobs I've had were ones that I was not rightfully qualified to have (and I made that clear to my employers before they hired me). I don't want to give myself credit where it's not due, but I would say that perfect humility dispenses with modesty. In nearly every single development job I've had, I have exceeded the expectations of my employer, and proved to be a valuable asset. There are of course exceptions1. But my point is I'm fairly intelligent and was able to teach myself what I needed to know in order to be successful at my job. With each job I had, I was stretched more and more. I attend the University of Washington's Seattle campus, and am currently in my fourth year with two years left, working on a Math degree. During the various jobs I've had (see my résumé if you want that list) I've also been attending school as a full time student. As I think most developers would agree, studying the typical general ed undergraduate courses, including introductory programming courses ABSOLUTELY PALES in comparison with writing real code, building real2 products, working with awesome people, and positively affecting the lives of users3. So... as things go... I spent far more of my time and energy working instead of focusing on my studies. At times I performed very horribly, but for the most part I was able to stay afloat with my grades. However the computer science program at UW is _very_, _very_, _very_, _very_ competitive. So, it was no surprise to me when I got rejected by the program. Twice. Ironically enough, the same half-hour window in which I received the always polite, albeit disheartening rejection notice via email, I got a phone call from Amazon offering me a summer internship4 as an SDE. As I look around at other 'gents my age (21), who share the same goals as myself in software development, I find myself feeling pretty good about where I'm at, what I'm learning, who I am, and what I can do. There are of course much, much, much more brilliant 21 year olds out there than myself, I don't mean to say I stand out in a crowd, merely that I feel like I'm not abysmally behind the progress of my average peer. I feel confident about my ability to be successful in the world of software. More importantly I feel confident in my ability and desire to continue to grow, learn, and be embarrassingly humbled when I really need it. ### Math Degree I find myself pursuing a Math degree with the sole purpose of having a degree. There are those that say I should drop out and start working now (as I've had opportunity to do), and there are those that say I should really finish my degree. I've made up my mind to go ahead with my degree for entirely different reasons than either camp tends to bring up, so please don't encourage me one way or another on that matter. Consider the issue "closed" :) _*DEEP BREATH*_ ...sorry this is longer than I anticipated. ### This in essence, is my question:   * How do I objectively determine what areas of study, general knowledge, and other skills I would have gained through a CS degree that I may or may not be lacking in now?    * How do I sort these skills in order of most importance?    * What is the best way (over the next two years) to supplement my education to attain those attributes in such a way to match or even surpass the level of a CS undergrad from a top university? **Here are the steps that I am taking already:**   1. Ask the development community (this post)    2. Pursue mentorships with seasoned developers who share a similar career path with me    3. Define short and long term "learning" goals and subsequent syllabi outlining topics of study    4. Continue to write code and work on projects that I'm passionate about  If you've gotten this far, you deserve a cookie :) I appreciate you bearing with me. So... development community, seasoned developers, fellow students who are in the same boat as me, what advice would you have? Also... please do keep in mind my disclaimers at the top of this post about what I'm _NOT_ asking for. ### Update: I realize that I did not provide very concrete parameters for what I deem a successful "answer" to my question(s). I think the question is very vague, and could warrant a number of "correct" answers. After a reasonable amount of time I will select the answer that fits the following attributes:   * Explains the _why_ behind their answer   * Can speak from some level of experience (be it hiring/interacting with or being someone who has/is in my shoes)   * Is concise but thorough, gives broad principles preferably coupled with specific examples   * Lastly, considering the length that matching the above would seem to require, please make it a good well communicated answer that's pleasant to read. Others who may be interested in this in the future I would hope would be entertained as well as educated by the response. So there are some parameters for "correct". They're very high I think, but I've designed them as kind of an outline for what I envision the "best" answer would be. Obviously given enough time I'll select the closest matching response as the "answer". * * *               (1) - I worked on a prior version of this website, and while we did not have an explicit            conversation about it, I felt that I was not able to do very well at all (this can be            evidenced by the fact that they have since changed their website entirely)     (2) - Firstly, yes, it's a real product (even though I'm writing this post in Chrome...), and           it kicks ass. Secondly, I was a high school intern developer in test, wrote proof of            concept code for some of the new features for IE8... so it was a while ago.     (3) - At the time of this posting I am the developer who wrote this app, I am no longer           responsible for it's code base     (4) - My internship will start in June of 2012, and I'll be working in the Web Store            team.


SQL Triggers and when or when not to use them.

When I was originally learning about SQL I was always told, only use triggers if you really need to and opt to use stored procedures instead if possible. Now unfortunately at the time (a good few years ago) I wasn't as curious and caring about fundamentals as I am now so never did ask to the reason why. What's the communities opinion in this? Is it just someone's personal preference, or should triggers be avoided (just like cursors) unless there is a good reason for them.


What are the technical contributions of the pornography industry?

I recently read that the pornography industry contributed to technical innovation. What the heck are they talking about? Do these companies have R&D budgets?


Is it appropriate to have positive comments in code reviews, or is it exclusively for constructive criticism?

I have been doing a lot of code review lately, and I am unsure of the positive and negative effects and professionalism of putting positive and/or funny comments in code reviews. We use Github as our code review platform on my team, so the comments are viewable by anyone. I generally try to use this platform so the entire process from start to finish is visible and historical.


Add behavior without changing existing class

I have a class `Container`, which represents wrapper around `std::list`. This class contains following public methods:   * `void add(Shape *item)`   * `void next()`   * `void setBegin()`   * `Shape* curr()` and protected variables   * `std::list <Shape*> _container`   * `std::list <Shape*>::iterator _iter` Now I need add sorting of Container without changing existing class code. Which pattern should I use? I think, that Decorator is most appropriate pattern in this case. Should I redesign class Container?


In iOS, y-axis starts from the top and grows downward. It is the opposite to OSX. What is the rationale and technical advantage behind this change?

In iOS, the coordinate (0, 0) means the top left corner. In OSX it is the bottom left corner. What is the Apple's rationale or technical advantage of this coordinate system?


How is it possible that facial recognition software can work, but a reCAPTCHA can't be solved by a computer

If software can be built to recognize faces and match those faces to names, then how is that CAPTCHA works? Recognizing letters seems a lot easier than matching faces.


Splitting object definitions (catalog) from instances (physical objects)

I am wondering if there is a design pattern for such problem: Let's say we are building a web shop for a doors and windows manufacturer, where customer has a catalog (list) of products, from which he can choose some and customize them, before placing an order. Each product has it's properties defined, like name, price, description. Obviously, the customer is not allowed to change any of these properties. But there is a space to customize the product. When he chooses a window, then he can choose it's colour, dimensions, perhaps a color of glass and choose some additional features. When he chooses doors, then he can choose a color, dimension, but also a type of the lock. First idea that came to my mind is:   1. Create products definitions classes (WindowDefintion, DoorsDefinition), which hold information about the name, price, description. These are listed in a catalog   2. Create product instances classes (Window, Doors), which hold reference to the product, but also add customizable fields, which are specific to certain instance. Disadvantages are perhaps silly, because it is mostly about creating a definition class for each instance class, but this involves more doubled amount of database tables and repositiories as well. I was just wondering if there is some other solution? This example is not the case. I am using it to ease understanding of the problem. In the case, products don't have a good common generalization, which a Product would give in this case (good for having name, description and price properties).


How to handle affinities?

Assume we have an abstract class having several concrete classes which interfaces publish an information under several equivalent forms, with the difference that each class has a preferred form which can be consulted at no cost while consulting the others might require a time-consuming computation. How to implement a strategy selecting an algorithm based on this “affinity”of one class for one information form? ## Example The original example is a complicated example of a very specialised field, so I will do my best to figure out an example that will be familiar to most programmers. Assume we have an abstract class representing I/O devices which has two concrete subclasses, one for char-based devices and one for block-based devices. Each class provides block-based access and cahr-based access, but each class has an affinity to one of these methods: block-based access is preferred for block-based devices, etc. Say, we want to implement a copy procedure, so that, if the source and the target devices are block-based then the copy is performed block-per-block, in all other cases, a char-by-char approach is preferred. ## Discussion Assume now we have not only I/O devices but several abstract classes offers access to several logically equivalent methods, but whose implementation differ greatly in perormance, thus displaying a greater affinity to one method over the others. We want to implement a strategy working on an aggregate of such classes and selecting an algorithm taking the affinities of these classes into account. Because of the combinatoric complexity brought by the aggregate, the visitor- pattern does not seem useful here. ## Question How can each concrete class expose its affinity for one or the other access method in a way that is useful to a strategy component picking up an algorithm suited to these affinities? The combinatorics yield a large number of combinations of affinities and the strategy only needs to consider a few “lucky cases”and use a generic algorithm to handle the vast majority of combinations.


if else brackets on same line, best comment style?

I used to do this:               // If the cat is black     if ( $catColor == 'black' )      {       ...     }     // Otherwise eat a taco     else     {       ...     }      But I've more recently started to move toward this style of conditional statements:               if ( something ) {       ...     } else {       ...     }      But now, where is the best place to put a comment for my else block?               if ( something ) {       ...     // Otherwise...     } else {       ...     }      That just looks weird cause its in the if block. Only other alternative is               if ( something ) {       ...     } else { // Otherwise       ...     }      But that looks/feels weird. What is the best approach to comments with this style of conditional blocks?


When should I invalidate a cache of a user's credentials?

We develop a Windows client application that locally caches a user's credentials for connecting to our server application using the **Windows Credential Management API**. **Our caching logic works in the following way:**   1. The user opens the application and **selects a server** in the UI. It then queries the server for authentication requirements. (If no credentials are needed, then we just connect without authentication.)   2. The application **reads the cache** to see if there are cached credentials.   3. If there are **existing cached credentials** , they are used. Otherwise, the Windows API is used to bring up a **dialog box**.   4. The application attempts to **authenticate with the server** using the credentials.   5. If the connection is a success, then the credentials used are **cached for the lifetime of the Windows session** (this is a feature of the Windows API). Otherwise, we **clear the cache** and return to step 3. **The question is: are there other valid situations where the credential cache should be cleared?** In other words, what would you consider to be best practices on how to manage the lifetime and invalidation logic for this potentially sensitive information? _(Since I will probably be asked, the information we store using this API is encrypted using our own encryption logic, and stored in memory via SecureString. No doubt there are potential holes in this approach, but that is for another discussion.)_


Developer failing developer interviews

I'm a Java developer, mostly doing Spring stuff. I understand the patterns, OOP, bean injection, multithreading and everything that goes with it. I don't feel like I'm a bad developer, I get my stuff done. So let's say I go to some developer interview. It shouldn't be a problem to get a job, right. No. I go on an interview, and usually I pass the interview where they ask about my dreams, salary and all that personality stuff. Then they give me a technical assignment, something to program, some tricky question, a codility test in limited time. I fail. I get below average results. I don't understand why? Am I that bad? It even pisses me off, that I have to prove myself and fail. In general I've been programming for four years. It's not like I'm writing some crap, that barely somehow works; it's structured. I got the current job by showing something I had done in my spare time, and it impressed. It's impossible for me to get a developer job by passing all those tricky hoops. Also, the actual work is not that hard, all the sorting algorithms, cryptography and somewhat difficult problems are usually encapsulated. Why are the interviewers asking you to do something you did once back in university many years ago? Is this normal? Is there something I can do to improve myself? How do I get the job?


How to distribute a web app (that's hosted by the customer)

We're developing a web app that visualizes financial data. We have our first customer, but hope to get more. The terms are that   1. the customers pay a setup fee, to customize the app for their needs   2. the customers pay a monthly fee to license the app   3. the customers install and host the app on their own servers (Some details: the server just requires a simple node.js installation. There is no database required. Everything is easily installed via npm. All the modules used a open source.) Our source code is not public, but it doesn't need to be obfuscated or hidden from the customer. My Questions:   1. How should we distribute the source code to customers? GitHub seems logical, with the idea that customers just use git to deploy and update. But a customer should only have access to the source code with the customizations made for them – not for other customers. What's a good approach to setting up repositories for distributing these different versions? Where do those live in relation to the development branch?   2. How do we go about licensing the code? That's a big question. Hopefully not too big. Partial answers or links to articles are welcomed. Thanks...


Best practices for moving large MS Access application towards .Net?

We have a really huge MS Access application developed in-house initially for our personal needs which then was turned into a commercial software and successfully sold. The software is a sort of "all-round-software-for-your- business" and contains several modules including Document Management System, Enterprise Resource Planning, Inventory Management, Customer Relationship Management, Data Analysis etc. We are quite satisfied with the current functionality of the application, but in order to meet the requests from our clients we realize that we have to move to something new. We decided to gradually move our application towards .Net because we can stick to Visual Basic .Net: even though it is a new language for most of the developers here, we have deep knowledge of VBA and several dozen small projects implemented in VB6. We already started moving the data layer functionality of our application to MS SQL Server, so that every data manipulation and search is performed directly on the server. What we are looking for are best practices for gradually moving our extensive GUI (about 500-600 different forms including subforms, about 200 reports with multi-language support etc). Following the recent request from our potential customer to implement asynchronous data encryption on documents in DMS we would be also happy to completely decouple this part from MS Access and implement it in .Net. The question is how to seamlessly integrate the .Net application with the existing MS Access system, so that we can invoke it with certain parameters (user rights etc.) and enable data exchange between this application and running MS Access application. * * * **EDIT:** We tried to apply some practices from Martin Fowler's book "Enterprise intergration patterns" to achieve some integration between the MS Access application and some small utilities we implemented in .Net for various needs. But we only managed to use the "shared database" pattern and weren't really satisfied with our solution. For instance, we implemented a small utility running as a Windows service which automatically downloads all messages from the mail server using POP3 connection and stores them into one table, whereas all attachments are stored in file system. What we mainly did is we used ADO.NET to directly access MS Access databases in MDB format and populate table with some processed data (like the data about mail messages from the example above: we have fields for FROM, TO, CC, BCC, Subject and Body). **There is absolutely no problem to work with MDB data format from .Net** , moreover we don't want to stay with MDB and upsized almost everything to MS SQL Server 2008 -- this gives us much more freedom concerning the data management and scalability. The main problem here is that **we don't know how to implement a sort of "callback"** in Access so that we can trigger the execution of certain VBA code on data update. We had great hopes with MS Access 2010 supporting **update and insert triggers for data tables** , but it turned out that we can only use MS Access Macros for these triggers and there is no way to execute any custom VBA code within the trigger. We also tried some solutions with **sending keystrokes directly to MS Access window** to mimick some user-invoked data requery. This works, but we don't think this is a realiable solution that can be used in production. We also looked into DDE for MS Access, but **we couldn't find any good sample solution implementing DDE commands** and using them for in-memory data and command exchange. So, the main problem is to have MS Access and .Net application co-exist and interact with each other. **EDIT2** : I forgot to mention what **we also implemented MSMQ library in VBA** for message passing between .Net and MS Access, the problem was again the lack of callback here: we really had to poll the queue for new messages and given that VBA does not really support multi-threading it wasn't really a nice solution.


Alternatives to Pessimistic Locking in Cluster Applications

I am researching alternatives to database-level pessimistic locking to achieve transaction isolation in a cluster of `Java` applications going against the same database. Synchronizing concurrent access in the application tier is clearly not a solution in the present configuration because the same database transaction can be invoked from multiple JVMs concurrently. Currently, we are subject to occasional `race conditions` which, due to the `optimistic locking` we have in place via `Hibernate`, cause a `StaleObjectStateException` exception and data loss. I have a moderately large transaction within the scope of my refactoring project. Let's describe it as updating one top-level table row and then making various related inserts and/or updates to several of its child entities, each being one-to-many. I would like to insure exclusive access to the top-level table row and all of the children to be affected but I would like to stay away from pessimistic locking at the database level for performance reasons mostly. Does it make sense to start a single (perhaps synchronous) message queue application into which this method could be moved to insure synchronized access as opposed to each cluster node using its own, which is a clear race condition hazard? I am mentioning this approach even though I am not confident in it because both the top-level table row and its children could also be updated from other system calls, not just the mentioned transaction. So I am seeking to design a solution where the top-level table row and its children will all somehow be pseudo-locked (exclusive transaction isolation) but at the application and not the database level. I am open to ideas and suggestions, I understand this is not a very cut and dried challenge.


When must arbitrary precision arithmetic functions be used in PHP?

My colleague uses the Binary Calculator functions in bandwidth calculations; as much as terrabytes, and with percentage splitting on allocation. His usage of these functions appears correct in order not to lose a byte; although he seems to be using them now for everything. The manual only says: > For arbitrary precision mathematics PHP offers the Binary Calculator which > supports numbers of any size and precision, represented as strings. How much is any size? Is it really necessary? How big is the default float in PHP? Are there any good advice regarding this or things to keep in mind?


Guidance on connecting a common database to several instances of the same application

I'm looking for advice regarding a future development of mine, concerning a application that may be run in several machines that need to use and manipulate the same data. As this sounds somewhat vague let me elaborate on it. Picture a desktop application where the user manages information about clients, appointments, client history and what not. Now assume a handful of users using the same application in different machines need to use the same data mentioned. I believe the best way to tackle this situation would be storing the database in a central location, provided an API (REST for example) is in place to be used by every application instance. Assuming there could be about 5 to 10 application instances running requests on the database. Would this be the best way to go about providing low response time reply to requests by each instance? Does anyone know of something better or if this is the best way to go. What suggestions, advise, guidance, best practices, do and don't do would you tell me about. Thanks. **EDIT: Question clarification and its context on the application** The development will be composed of a client application that will connect to a server application, initially the client application will be a desktop application, however, future web and mobile client applications may be also developed if the user baseline demonstrates such desire. This is yet a basic sketch of how things might be since we still iron out the edges. The client application will be composed pretty much by the user interface and client server end to end communication. The server application will be devised in three layers:   * Service layer: This layer provides means by which the clients issue requests to the server and replies are sent back. Additionally this layer also acts as a client to other third party services like email (SMTP) and text message delivery (SMS Gateway) when clients request such actions.   * Logic layer: Business logic regarding requests issued by the clients is processed here.   * Data layer: Where database operations are performed. My doubt is about the service layer when connecting with client applications, I believe I should develop my own communication protocol with sockets and serialized objects to reduce the time it takes the client to reconnect with the server to issue new requests. The time I'm referring too is the time it would normally take for a regular HTTP request to perform an handshake before sending the request to the server like a regular REST API anyone would access via a web server. Should I develop my own connection protocol with a persistent socket connection and serialized objects being exchanged or go with a regular REST API. Some clients might send many requests one after the other for hours, but yet others might send a couple requests and that would be the end of it. I'm undecided on the path I should follow here, REST or a custom socket connection protocol like mentioned before? **UPDATE: Socket will be the way to go.** We have chosen to create a custom communication protocol with sockets and keep alive available when the client application notices high demand on part of the user, this also allows us to have clearer view of which clients are connected and maintains a open channel with the client application, which might be useful for feature upgrades in the future.


Showing a View from another View in MVP

This question is regarding MVP triads. Lets say I have two triads and first one has `View1`, `Mode1` and `Presenter1`. Second triad has `View2`, `Model2` and `Presenter2`. Now what I trying to do is, I just want to display the `View2` when I click a `button` in `View1`. You'd show the `View1` calling it's presenter's show method.               View1Presenter presenter1 = new View1Presenter (view1, Model1);     presenter1.show();      Now When I click `btnShowView2` button on the `View1`, it should display the `View2`. So how to call `presenter2.show()` from `View1`?


TotalPhase Aardvark driver's GPL license

I'm using an SPI host adapter for a project. The Aardvark from TotalPhase. And I did something crazy, I read that EULA license that everyone just clicks through. The driver installation license includes these bits: > This driver installer package also includes a WIN32 driver that is entirely > based on the libusb-win32 project (release 0.1.10.1). > > ... > > LICENSE: > > The software in this package is distributed under the following licenses: > > Driver: GNU General Public License (GPL)   >  Library, Test Files: GNU Lesser General Public License (LGPL) Now, my understanding of of the GPL is that it's sticky and viral. If you include software then the whole project has to be released under the GPL (if you distribute it, you can do whatever you want with in-house projects). If the driver was like the library, and was licensed under the LGPL, it could be used by my closed source proprietary project, as long as it's source and license was passed along with it. But it's not, it's pure GPL. If I include this driver in my project and distribute it, am I required to release my project under the GPL?


Get attribution when other people use my code

I have this portfolio website containing some personal projects/algorithm implementations. I want to get attribution if and when other people use my code or snippets of it. I initially thought of using Creative Commons but, as CC itself points out, CC doesn't fit well with software/code distributions. I would've used CC0 but CC0 does not enforce attribution. So, is there a way for me to enforce attribution on my code ala CC? Including a copy of a FOSS license with every code distribution I have seems overkill--- the license itself might be longer than some of my codes. Will copyright claims on top of source codes work if I say there that attribution is required?


Does it work when a developer is the project manager's boss?

I am in the planning stage of a project and I am looking to hire a project manager. I would like to do some coding and keep eye on all parts of the project. However, i have a feeling that a project manager will get better results. I have the following options: 1) manage the project and not code 2) hire a project manager and code myself I am worried that the project manager will feel impeded by having the project owner in the development team. If I run the project, the team might fall apart causing the project to fail. To stick within budget, I have to be involved in one capacity or another. Does anyone have experience with this situation, any suggestions? more info: 4 in-house developers each responsible for a specific area. The developers can also outsource work if agreed to by the project manager.


Integrated ads in phone apps - how to avoid wasting battery?

Considering the PCWorld review that came out in March: > ### Free Android Apps Packed with Ads are Major Battery Drains > > ...Researchers from Purdue University in collaboration with Microsoft claim > that third-party advertising in free smartphone apps can be responsible for > as much as 65 percent to 75 percent of an app's energy consumption... Is there a best practice for integrating advert support into mobile applications, so as to not drain user battery too much? > ...When you fire up Angry Birds on your Android phone, the researchers found > that the core gaming component only consumes about 18 percent of total app > energy. The biggest battery suck comes from the software powering third- > party ads and analytics accounting for 45 percent of total app energy, > according to the study... Has anyone invoked better ways of keeping away from the "3G Tail", as the report puts it? Is it better/possible to download a large set of adverts that are cached for a few hours, and using them to populate your ad space, to avoid constant use of the Wi-Fi/3G radios? Are there any best practices for the inclusion of adverts in mobile apps?


Should I take help of Internet and other programmers or I should do all programming myself?

I am a developer in a good company. I was given a task by my company to accomplish within a week however I finished the same in 4 days, my boss, the client, and other team members all are happy by my work; even I was! However suddenly I got a thought in my mind: "For my work I took some code from internet and mixed it up with my programming and gave the result faster however, my worry is that I should have done the task all of my own so that I would have a better understanding of it (even which was taken from internet)". Can anyone tell me if I am ruining my programming career this way (I mean by using others code)?


WPF properties memory management

I'm trying to build binding system similar to the one that is used in WPF and I ran into some memory leaking problems, so here comes my question - how is memory managed in WPF property system? From what I know in WPF values of `DependencyProperties` are stored in external containers - what I wanna know is how are they collected when `DependencyObject` dies? Simplest solution would be to store them is some weak reference dictionary - but here comes the main problem I ran into - when there is a listener on property that needs reference to its (this property) parent it holds it (the parent) alive (when value of weak reference dictionary points somewhere, even indirectly, to key - it can't be collected). How is it avoided in WPF without the need of using weak references everywhere?


User Story or User Stories for this specific requirement

I have to write a user story for a requirement that involves passing search filters to the same URI and retrieving corresponding results. I have 5 filters. I plan to write 5 different stories of type: As a URI user I can search by #filter1 so that I can retrieve results based on #filter1. And then a 6th story that involves searching one or more or all six filters in conjunction. Is this is a sensible route to take?


Does a programming language increase/decrease value?

Let's say you develop a software program for Windows in C#, then Joe Blow develops the same software program for Windows but instead codes it using C++. If Joe Blow were to sell that software program, what would determine who would get more money for it given the different languages? Assuming, both used the same licensing system and the only difference between the programs was the source code.


What is the proper way to store an object with many attributes in Objective-C?

I have an object that I am downloading over HTTP, that has approximately 50 attributes. What is the proper way to store this information in Objective-C? Should I have an NSObject with a property for each attribute (if so, what would be a good way to initialize this object?)? Should I use an NSDictionary with 50 key-value pairs?


Job hopping, is it a problem?

How would you, as someone involved in the hiring process (manager,interviewer, etc) feel about a candidate that has changed jobs every 1-2 years? **update**   Thanks for all the input everybody, some really great responses, and good info in every post. I asked it because I'm currently at my 3 job in the last 5 years and I'm feeling like my position is going nowhere (like the position should have been contract in the first place, not full-time). My only options here seem like transition to a different team doing something I'm not really interested in or look for new work, but I'm a little afraid my recent job history is all short stints.


What's is the point of PImpl pattern while we can use interface for the same purpose in C++?

I see a lot of source code which using PImpl idiom in C++. I assume Its purpose is to hide the private data/type/implementation, so it can remove dependence, and then reduce compile time and header include issue. But interface/pure-abstract classes in C++ also have this capability, they can also be used to hide data/type/implementation. And to let the caller just see the interface when creating an object, we can declare a factory method in the interface's header. The comparison is:   1. **Cost** : The interface way cost is lower, because you don't even need to repeat the public wrapper function implementation `void Bar::doWork() { return m_impl->doWork(); }`, you just need to define the signature in the interface.   2. **Well understood** : The interface technology is better understood by every C++ developer.   3. **Performance** : Interface way performance not worse than PImpl idiom, both an extra memory access. I assume the performance is same. Following is the pseudocode to illustrate my question:               // Forward declaration can help you avoid include BarImpl header, and those included in BarImpl header.     class BarImpl;     class Bar     {     public:         // public functions         void doWork();     private:         // You don't need to compile Bar.cpp after changing the implementation in BarImpl.cpp         BarImpl* m_impl;     };      The same purpose can be implemented using interface:               // Bar.h     class IBar     {     public:         virtual ~IBar(){}         // public functions         virtual void doWork() = 0;     };          // to only expose the interface instead of class name to caller     IBar* createObject();      So what's the point of PImpl?


Is it realistic to test web application with tomcat while production server are using WebSphere?

In our company we use WebSphere Application Server to hold web application but it is not available for developers because of license issue. We have been using Tomcat to test the web application and hope that it works fine with WebSphere on production phase. I would like to adapt spring framework into our POJO web application servlet with oracle JDBC and I am not sure of how much WebSphere support spring framework. I checked with the IBM site and it seems not realistic to test web application with tomcat because there are some pitfalls in using spring in WebSphere as a container. http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html P.S. I have no experience in using spring or any java framework.


Algorithm for flattening overlapping ranges

I am looking for a nice way of flattening (splitting) a list of potentially- overlapping numeric ranges. The problem is very similar to that of this question: Fastest way to split overlapping date ranges, and many others. However, the ranges are not only integers, and I am looking for a decent algorithm that can be easily implemented in Javascript or Python, etc. **Example Data:** ![Example data](http://i.stack.imgur.com/NRAkh.png) **Example Solution:** ![enter image description here](http://i.stack.imgur.com/HP8Ri.png) Apologies if this is a duplicate, but I am yet to find a solution.


Jasmine BDD vs Integration Tests

Let's say I need to write a test for the front end, in the following BDD style:               A user visits buysomething.com,      saves something to their wishlist,      and a saved item count is updated.       The result of the test is that DOM gets manipulated. In my heart I feel this is better suited as an integration test - but my team is currently using jasmine to load fixtures and test such interactions. This can lead to brittle tests as they are reliant on a static fixtures instead of the actual markup. Are we misusing Jasmine here?


Storing primary keys of objects in Redis and then querying them in Postgres through Django

This is probably my second time posting in programmers. I'm usually on stackoverflow but this question is more fit for the community here. All suggestions, advice and insight on this matter is extremely appreciated. I require you're brutal honesty as well. If you think what I'm currently doing in terms of design is really stupid, TELL ME! because I'm a self-taught back- end software engineer and I can use all the advice I can get. I use Django, Redis & PostgreSQL. Let's say for example I have a User, Post & Location model.               #models.py     from django.db import models     from django.contrib.auth.models import User          class Post(models.Model):             user = models.ForeignKey(User)             media_url = models.CharField(max_length=255, blank=True)             related_location = models.ForeignKey('Location')          class Location(models.Model):             name = models.CharField(max_length=200, blank=True)             address = models.CharField(max_length=255, blank=True)             city = models.CharField(max_length=140, blank=True)      Great, now that's out of the way, let's say users wanted to see all the posts tagged at a certain location. This location has an ID of 1812. The normal way of doing this is to make a simple query and return posts where the related_location has an ID of 1812. I would paginate the results so that user will see 10 objects at a time. If they want to see more, they need to make another request. I used to do things this way, until recently I've had the scare of databases growing potentially large and queries becoming really slow. So I decided to create indexes on Redis for each Location object. For example, let's say posts 7, 33, 18, 12, 89, 56500, 34000, 30 we're all tagged at location 1812. I would create a Redis List called 'location:1812' and in that list, it would contain the IDs of all the posts that we're tagged there, in this case redislist = [7, 33, 18, 12, 89, 56500, 34000, 30]. I would then take this list and query against it:               queryset = Post.objects.filter(pk__in = redislist).order_by('-pk')      Is this a smart thing to do? Immediately I began to think of the pros and cons of the approach. For one, queries to the DB would be faster since I already know which objects I need to grab. However, in terms of design, is it worth it? For something like unique location objects, that table in postgres alone can grow infinitely large (Can have over a billion rows). Storing a list for each location object in Redis can be costly (memory running out). So it all comes down to this. Is the DB good enough, or should I continue doing what I am doing?


Are database developers considered under DBA jobs?

This isn't career advice, this is more of a question of logistics. When looking at job market and such there is a lower than what I think would be out there of database admins but I'm curious if database admins actually include strictly database developers, or of database developers are more under a blanket term "Programmers" or "Software Developers"? Like someone who enjoys programming SQL/Queries/Stored Procedures and such but probably knows some about settings a database up and such? Would this be under the DBA term or something else? (Since I haven't seen any reports for Database Developer in "job market forecasts" and such)


How does a browser determine that a script has run for too long?

How does a browser determine that a script has run for too long ? Is it actually configurable through some advanced settings ?


How does font rendering actually work?

I realize that I know essentially nothing about the way fonts get rendered in my computer. From what I can observe, font rendering is generally made in a consistent way throughout the system. For instance, the subpixel font hinting settings that I configure in my DE control panel have influence on text which appears on window borders, in my browser, in my text editor and so on. (I should observe that some Java applications show a noticeable difference, so I guess they are using a different font rendering mechanism). What I get from the above is that probably all applications that need font rendering make use of some OS (or DE)-wide library. On the other hand, browsers usually manage their own rendering through a rendering engine, that takes care of positioning various items - including text - according to specific flow rules. I am not sure how these two facts are compatible. I would assume that the browser would have to ask the OS to draw a glyph at a given position, but how can it manage the flow of text without knowing beforehand how much space the glyph will take? Are there separate calls to determine the glyph sizes, so that the browser can manage the flow as if characters were little boxes that are later filled in by the OS? (Although this does not take care of kerning). Or is the OS responsible for drawing a whole text area, including text flow? Does the OS return the rendered glyph as a bitmap and leaves it to the application to draw that on the screen?


How should a programmer prepare for a new job?

I have just graduated from college and have about 2 months time before I start working at the company. I have experience in C, C++, Java and a bit of Android (developed an app last summer, stopped working on that later). I just want to learn something new while improving on my basic C , C++ and Java skills. I really need some advice on what I should start learning so that I will be able to work on whatever is given when I start my job... or in the sense that helps me improve from my present level... or that helps me understand things much better, assists me in getting a good understanding of things, etc.


Educational, well-written FOSS projects to read, study or discuss

Before you say it: yes, this "question" has been asked other times. However, I could not fine many of such questions and not that easily, and those I found had similar results. What I'm trying to say that there are no comprehensive lists of well written Open Source projects, so I decided to set some requirements for the entries (one or possibly more):   * **Idiomatic** use of the language in which they are written   * The project should be **lightweight**. Not as in "a few kbs", as in "clean" and possibly following the UNIX philosophy, making an efficient use of resources and performing its duty and nothing more. **No code bloat** , most importantly. Projects like Firefox and GNOME wouldn't qualify, for example.   * Minimal reliance on external, non-standard libraries, with exceptions for some common FOSS libraries (curses, Xlib, OpenGL and possibly "usual suspects" like gtk+, webkit and Boost). Reliance on well-written libraries is welcome.   * **No** reliance on **proprietary** software - for obvious reasons (programs that rely on XNA, DirectX, Cocoa and similar, for example).   * **Well-documented** code is welcome. Include link to web interfaces to their repositories if possible. Here are some sample projects that often pop up in these threads: _**Operating Systems_**   * Plan 9 from Bell Labs: More or less, the official "sequel" to UNIX. Written in C by the same people who invented C!    * NetBSD: The most portable BSD implementation, written in C and also a good example of portable and organized code.  _**Network and Databases_**   * Sqlite: Extremely lightweight and extremely efficient, one of the best pieces of C software I've seen. Count the lines yourself!   * Lighttpd: A small but pretty reliable web server written in C. _**Programming languages and VMs_**   * Lua: extremely lightweight multi-paradigm programming language. Written in C.    * Tiny C Compiler: Really tiny C compiler. Not really comparable to GCC or Clang but does its job.   * PyPy: A Python implementation written in Python.    * Pharo: OK, I admit it, I'm not really a Smalltalk expert but Pharo is a fork of Squeak and looked rather interesting.   * Stackless Python \- An implementation of Python that doesn't rely on the C call stack - written in C (with some parts in Python) _**Games and 3D:_**   * Angband: One of the most accessible roguelike codebases around here, written in C.   * Ogre3D: Cross-platform 3D engine. Gets bloated if you don't skip the platform-specific implementation code, otherwise is a pretty solid example of good C++ OO.    * Simon Tatham's Portable Puzzle Collection: Title says it all. _**Other_** \- dwm: Lightweight window manager. Written in C. _**Emulation and Reverse Engineering_** \- Bochs: x86 emulator, written in C++ and tiny enough. \- MAME: If you want to see C at one of its lowest levels, MAME is for you. May not be as clean as the other projects but it can teach you A LOT. Before you ask: I didn't mention Linux because it has become quite bloated in the last few years, Linus has also confirmed it. Nonetheless, it'd be a great educational read the same, even if for other reasons. Same for GCC.


How do you code without offending?

What I mean by that is, how do you go about developing on a code base you share with developers who have been working on it for years and are very familiar with it? I don't want to step on anyones toes, but I get not so subtle complaints about the way I do things, whether it be how I whitespace my code, or how frequently I checkin to SVN (too often). So while I can change those things easily -- I want to be a better team developer in general. I'm not sure what to do, other than ask, but maybe you guys have some thoughts I could put to practice. **UPDATE** There isn't any style guide to speak of -- it's just people aren't used to sharing the codebase. Everyone has their own little siloed code-world. This is a perl shop, but I'm sure these apply to any language **UPDATE 2** The CTO who later became CEO was a complete megalomaniac and was the primary source of these complaints. If you didn't do things exactly how he liked, whether it was using a Mac, or Emacs, or 4 tab spaces instead of 2, or dress a certain way, you were inferior. It was a horrific situation that I tried to correct, but the only correct answer for me was leaving. I am convinced that this was an instance of **bullying** in a workplace, and subsequently, I'm more aware of what might be subtle bullying and inappropriate behavior in a work environment. **To any developer looking for answers to a situation like this, leave immediately. You can't teamwork your way out of a bad team situation.**


Is adding Ad Hoc reporting to an application worth the effort?

We have an application which collects a lot of data and has reporting baked in to it. The first iteration was a Crystal Reports integration which worked nicely. Create the report in Crystal Report designer and then import the RPT file into the application. This worked nice but users needed the application to run a report and additionally users couldn't create a report. We added filters, sorters, and groupings so that RPT file was customizable, but they couldn't create one from scratch. The second interation was a web based solution using SSRS, SSAS, and the report builder tool from Microsoft. This required some database work and some work to get the cubes up and running from the OLTP schema, but in the end, it was much easier to create rollup reports. However, we still have to create the reports using the report builder tool, publish then out, etc. We also added filters, sorters, and groupers to make it "customizable". In both of these sceanarios we have about 30 to 50 out of the box reports created over time. Now there is some discussion about adding ad hoc reports so that users can create a report from scratch on the fly. Now our data model is very complex and requires a good working knowledge of it to make sense of it. To do this at a minimum would require a good amount of work to get the data model into a schema that is "more reportable" and easier to understand. I don't think our application is suitable for ad hoc reporting (not worth the effort). Has anyone had any success with providing ad hoc reporting? What tool set did you use? Did it have an impact on the success of your application?


Implementing technical paper algorithms in C++ or MATLAB

I am an Electrical Engineering undergrad. I've reading many technical papers about Signal and Image processing algorithms (reconstruction, segmentation, filtering, etc). Most of the algorithms shown in these papers are defined over continuous time and continuous frequency, and often give the solutions in terms of complicated equations. How would you implement a technical paper from scratch in C++ or MATLAB in order to replicate the results obtained in said paper? More specifically, I was looking at the paper "A general cone-beam reconstruction algorithm" by Wang et al (IEEE Trans Med Imaging. 1993;12(3):486-96), and I was wondering, how do I even start implementing their algorithm? Equation 10 gives you the formula of the reconstructed image at . How would you code that up? Would you have a for-loop going through each voxel and computing the corresponding formula? How would you code functions of functions in that formula? How would you evaluate functions at arbitrary points? I've read the book "Digital Image Processing" by Gonzalez and Woods but I'm still at a loss. I have also read about the Numerical Recipes book series. Would that be the correct way? What are your experiences programming algorithms from research papers? Any tips or suggestions?


How do you choose to use a specific programming language?

I was having a small talk between teammates about how you choose a programming language for use in a project which lead me to think that there are many criteria to choose one in the beginning of a project but no real standard. Do you chose a programming language for the syntax and semantics? Or do you choose one because it has the best support to do certain things? Or because you have better libraries? Or do you choose it for the paradigm? What criteria do you use to choose one language when you are going to do a project?


Develop on the lastest and greatest or stick with the well documented version?

Should I develop on the latest and greatest 1.7 version of Joomla or stick with the well documented version of 1.5? I'm new to Joomla (and webDev in general), so I bumble around, search online, and ask those wiser then myself. The problem is that the answers are for version 1.5, and don't apply to 1.7, so I'm floundering. Usually I'd go with using the latest and greatest.   * It should be supported longer   * It should have bug fixes    * New awesome things will be developed won't be backwards compatible   * The extensions and components for the old version won't be maintained  But I need to crank this site out in a month. And if I'm fighting bad or lacking documentation, it's going to be an uphill battle. So, stick with the latest and greatest or go install what all the tutorials, guides, and videos are geared towards?


Why is OOP difficult?

When I started using an object-oriented language (Java), I pretty much just went "Cool" and started coding. I've never really thought about it until only recently after having read lots of questions about OOP. The general impression I get is that people struggle with it. Since I haven't thought of it as hard, and I wouldn't say I'm any genius, I'm thinking that I must have missed something or misunderstood it. Why is OOP difficult to understand? _Is_ it difficult to understand?


Should I tell the interviewer I already know the answer to the question being asked?

In a programming interview if I am asked a question I already know the answer for, such as giving an algorithm for a particular problem. Should I disclose that to the interviewer? This issue only makes sense when there's a novelty aspect to the question. One example is "How would you reverse each word in a string, but not their order?". There also seems to be a division between easier stuff, that you are "supposed" to know, such as my example and harder more contrived problems. Whats your policy and rationale for dealing with this issue? If you are already familiar with the question/brainteaser, should you disclose this in addition to answering the question? Is there any ethical dilemma involved with not disclosing your prior knowledge of the question?


Written communication skills courses, how important are they for developers?

We usually worry about coding standards, ethics, latest technology etc. But at times we tend to ignore our writing skills and communicating skills. Do we need to pursue a communication skills courses? Which ones do you prefer? Any online courses available which you might have tried?


Gossip protocol in a Ring topology

I am implementing a gossip based membership detection mechanism. Lets say we have a ring topology, i.e. node1 only knows about the 2 nodes (node4 and node2) around it.                               node1                  -        -               -              -           node4              node2               -              -                 -         -                    node3      Now, gossiping says: Pick a node at random from the membership list. But, if we strictly follow the ring topology, then node1 should only try to gossip with node2 or node4. Other wise, only for communication the topology will become a clique rather than being a ring. Background: According to the Amazon dyanmo paper: > Each node contacts a peer chosen at random every second and the two nodes > efficiently reconcile their persisted membership change histories. If, that is the case, then is dynamo's implementation not following a "true" ring topology and only using ring for consistent hashing (replication) and using a clique for membership detection?


Programming using an old computer(s)

Anybody still programming using old computers, e.g. ZX Spectrum BASIC, Amiga BASIC, dumb terminals? If so, do you find it useful for programming using today's technologies? Lastly why do you do it? For fun?


SSD harddisks & programming

SSD harddisks have been on the rise lately. And I've been wondering if it's worth buying one as a programmer. Being able to save five minutes when starting my PC is fun but won't convince my boss. How does it impact a typical visual studio project containing hundreds of files? Compile times, accessing files, waiting for visual studio to do its thing... Are there any benchmarks that checked this? And ideally, how much time would one win each week by upgrading?


For an ORM supporting data validation, should constraints be enforced in the database as well?

I have always applied constraints at the database level in addition to my (ActiveRecord) models. But I've been wondering if this is really required? **A little background** I recently had to unit test a basic automated timestamp generation method for a model. Normally, the test would create an instance of the model and save it without validation. But there are other required fields that aren't nullable at the in the table definition, meaning I cant save the instance even if I skip the ActiveRecord validation. So I'm thinking if I should remove such constraints from the db itself, and let the ORM handle them? **Possible advantages** if I skip constraints in db, imo -   * Can modify a validation rule in the model, without having to migrate the database.   * Can skip validation in testing. **Possible disadvantage?** If its possible that ORM validation fails or is bypassed, howsoever, the database does not check for constraints. What do you think? **EDIT** In this case, I'm using the Yii Framework, which generates the model from the database, hence database rules are generated also (though I could always write them post-generation myself too).


What is the most complicated data structure you have used in a practical situation?

The germ for this question came up from a discussion I was having with couple of fellow developers from the industry. Turns out that in a lot of places project managers are wary about complex data structures, and generally insist on whatever exists out-of-the-box from standard library/packages. The general idea seems to be like use a combination of whats already available unless performance is seriously impeded. This helps keeping the code base simple, which to the non-diplomatic would mean "we have high attrition, and newer ones we hire may not be that good". So no bloom filter or skip-lists or splay trees for you CS junkies. So here's the question (again): Whats the most complicated data structure you did or used in office? Helps get a sense of how good/sophisticated real world software are.


higher order functions equivalent construct in TIOBE top 10 languages

I'm trying to find a language construct equivalent to higher order functions in the top 10 languages from TIOBE index. Here are my results so far:   1. **C** \- function pointers   2. **Java** \- anonymous methods, lambdas   3. **Objective-C** \- function pointers, selectors, blocks, delegates (as explained here)   4. **C++** \- function pointers, lambdas   5. **Basic** \- [ _missing_ ]   6. **C#** \- anonymous methods, delegates, lambdas   7. **Python** \- [ _I know it's possible, but don't know how it's called_ ]   8. **PHP** \- anonymous functions   9. **Perl** \- [ _missing_ ]   10. **JavaScript** \- functions Could You please help me with missing parts? And eventually correct any mistakes? I'm not looking for workarounds, but for built-in language constructs that allow to pass a function to another function.


How best to handle database refactoring within a team?

We are currently usign a roll-forward approach to DB changes, akin to `Migrations`, where each developer creates and checks in a script that promotes the latest version of the DB to a new state. Problems arise when multiple developers concurrently work on non-trivial tasks and end up making changes to the DB that interfere with each other. The 'non-trivial' bit is significant because if the tasks take long enough, and if DB changes occurr early enough in the cycle, neither dev ends up being aware of the other's changes, and we end up with either a DB merge nightmare (preferred case) or an inadvertently broken database. Can these situations be easily avoided? Are there database refactoring strategies that effectively handle the scenario of multiple developers actively changing the schema? If it matters, we use SQL Server.


In _JavaScript: The Good Parts_ by Douglas Crockford, he mentions in his inheritance chapter, > The other benefit of classical inheritance is that it includes the > specification of a system of types. This mostly frees the programmer from > having to write explicit casting operations, which is a very good thing > because when casting, the safety benefits of a type system are lost. So first of all, what actually is safety? protection against data corruption, or hackers, or system malfunctions, etc.? What are the safety benefits of a type system? What makes a type system different that allows it to provide these safety benefits?


Are go-langs goroutine pools just green threads?

The commentator here offers the following criticism of green threads: > I was initially sold on the N:M model as a means of having event driven > programming without the callback hell. You can write code that looks like > pain old procedural code but underneath there's magic that uses userspace > task switching whenever something would block. Sounds great. The problem is > that we end up solving complexity with more complexity. swapcontext() and > family are fairly strait-forward, the complexity comes from other unintended > places. > > All of a sudden you're forced to write a userspace scheduler and guess what > it's really hard to write a scheduler that's going to do a better job that > Linux's schedules that has man years of efforts put into it. Now you want > your schedule to man N green threads to M physical threads so you have to > worry about synchronization. Synchronization brings performance problems so > you start now you're down a new lockless rabbit hole. Building a correct > highly concurrent scheduler is no easy task. Another critique is here: > A single process faking multiple threads has a lot of problems. One of them > is that all the faked threads stall on any page fault. My question is - **arego-lang's goroutines (for a default pool) just green threads? If so - do they address the criticisms above?**


How to start with 2d or 3d modeling?

My goal is that i can show fractals either into a plane or an space... I thought opengl is the best beggining, but which is the best book oriented to "maths" and "maths graphics"?   1. Red book? http://www.opengl.org/documentation/red_book/   2. Opengl superbible? http://www.opengl.org/documentation/books/#opengl_superbible_4th_edition   3. Any other? And... can you suggest any IDE?


What are security advantages of Google Caja over using the web worker API?

I am currently looking into Google Caja to run user-supplied JS code in the browser and in Node. So far, I understand, that, in a browser context, "cajoled code" disallows reading and messing with the window state by running unsafe code through a full-blown parser that gets rid of all kinds of attack vectors, and then safely executing that code in an `iframe` of the same origin. However, I am currently working on a solution using HTML5's `Worker` (see here) and it seems to have the same effect. What does Caja have to offer that Worker does not have, other than the ability to customize security policies? Does it have any additional safety features?


Generics list without generics

I am using a very primitive Java that doesn't have Generics, and also I can't use reflection. I want to create a generic list so it would be typed safe (i.e. I only have a list that contains Objects and I want to create a list that contains specific object and not a mix). On the other hand I also don't want to create a different class for each possible list. Is there any other way to do that without the use of Generics?


Managing deployment scripts in the process of continuous delivery

My question concerns **deployment scripts** in the process of **continuous delivery**. Continuous delivery recommends that deployment scripts should be versioned into SCM just as normal code.   * What is the best practice to avoid issues such as checking out (e.g. from Git) a script that does not have the right permission or is not executable?   * Also, where in the SCM repository should deployment scripts be located?


Strategy for storing passwords/credentials in the context of continuous delivery

It is common sense not to store passwords/credentials into SCM. I would like to know then what would be a **good strategy for storing passwords/credentials** in the context of continuous delivery.   * Where and how do I store credentials?   * How do I retrieve and use those credentials/passwords?


Is there a website where we can discuss and improve upon code snippets? For example, if I have written some function and want to know what others think of it.


What is exactly bug in the requirements?

I've just looked for a formal definition and haven't found one. The term - "bug in the requirements" was always confusing for me, what does mean exactly?


Why #pragmas are not part of the C++ standard?

Usually the problem of having possible multiple inclusions is solved with a series of `#ifdef` `#ifndef` but the pragmas just solves this with a single line, apparently they are really useful and can make the code better in terms of readability. Why they are not part of the C++ and C standards? there is a better way to avoid multiple inclusions?


Why does the instruction "do" require a "while"?

Since this statement is so common: `while (true)` (Java) or `while (1)` (C) or sometimes `for (;;)` Why is there not a single instruction for this? I could think that an instruction that could do it is just `do` but `do` requires a `while` at the end of the block but it would be more logical to write an infinite loop like this               do {          //loop forever          }      Why not? AFAIK the instruction `do` always requires a `while` at the end but if we could use it like above then it would be a clear way to define something like `while (true)` which I think should not be written like that (or `for (;;)`).


Interview for job that uses skills you have no experience with?

I am currently employed as a software developer using C# and C++. However, I want to find a new job for personal reasons and applied for a job ad that listed PHP, CSS, and Javascript as the skills the company is looking for. I am interested in learning about PHP, CSS, Javascript. That company wants to interview me. However, I have very little experience with those so I don't know how to prepare. Is it likely that I won't even be asked questions about PHP, CSS, Javascript? What kinds of technical questions do you guys think I will be asked? To succeed, I just need to demonstrate that I am really eager to learn PHP, CSS, Javascript?


How to implement an email unsubscribe system for a site with many kinds of emails?

I'm working on a website that features many different types of emails. Users have accounts, and when logged in they have access to a setting page that they can use to customize what types of emails they receive. However, I'd like to also give users an easy way to unsubscribe directly in the emails they receive. I've looked into list unsubscribe headers as well as creating some type of one click link that would unsubscribe a user from that type of email without requiring login or further action. The later would probably require me to break convention and make changes to the database in response to a GET on the link. However, am I incorrect in thinking that either of these would require me to generate and permanently store a unique identifier in my database for every email I ever send, really complicating email delivery? Without that, I'm not sure how I would be able to uniquely identify a user and a type of email in order to change their email preferences, and this identifier would need to be stored forever as a user could have an email sitting in their inbox for a long time before they decide to act on it. Alternatively, I was considering having a no-login page for managing email preferences. In contrast to above where I would need one of these identifiers for each email, this would only need one identifier per user, with no generation or other action required on sending an email. All of these raise security issues, and they could potentially be used by people to tamper with others' email preferences. This could be mitigated somewhat by ensuring that the identifier is really difficult to guess. For the once per user identifier approach, I was considering generating the identifier by passing a user's ID through some type of encryption algorithm, is this a sound approach? For the per-email identifiers, perhaps I could use a user's ID appended to the time. However, even this would not eliminate the problem entirely, as this would really just be security through obscurity, and anyone with the URL could tamper, and in the end the main defense would have to be that most people aren't so bored as to tamper with other people's email preferences. Are there any other alternatives I've missed, or issues or solutions with these that anyone can provide insight on? What are best practices in this area? **Edit:** Here is the alternative I missed for anyone coming across this later. The smart way to do this is to include in the unsubscribe link a cryptographic signature of the user to be unsubscribed and what they are to be unsubscribed from. Nothing at all needs to be stored in the database, while being on par with security with the solutions I'd been considering.


C# Certification possibilities?

I have been studying C# for about six months at University. I would like to have something to show for my work. I know the certification scene changes from month to month and I'd appreciate if anyone can give me advice on what certification options are available to me. Thank you very much for your time. Mariko


What is the proper way to extract and pass parameters to call javascript functionality from my PHP page?

This is my situation: I have a search results page in PHP where most of the logic resides in a javascript file in order to avoid refreshing the page every time an action is performed. The first thing I do using PHP is filter out and save valid query string values to PHP variables and I make use of the htmlspecialchars function to prevent injection. Now, I'd like to call my javascript function using those variables, so I created a script tag at the bottom of the page in order to pass the PHP variables to it (see my example). When I put all of my javascript code inside of its own scope (as I read this was a good security practice), I realized that I could no longer call my function from outside of it. I also realize that the javascript method can still be called with anything a hacker wants, so does that mean I can't really make use of htmlspecialchars in my situation? Here's a stripped-down version of my code:               <?php     try {              if (isset($_GET["id"])) {         if (!is_numeric($_GET["id"]))           throw new Exception("URL is not in a correct format");         $id= $_GET["id"];       }       elseif (isset($_GET["keyword"])) {         $keyword = htmlspecialchars($_GET["keyword"]);       }     }     catch (Exception $e) {       // handle error     }     ?>

       <?php       if (isset($id)) {          echo '';               }       elseif (isset($keyword)) {          echo '';        }       ?>                This is basically the js:               function ShowSearchResults(key,value)     {         $.getJSON("includes/search_results.php?"+key+"="+value,          function(data) {           // populate search results           $(".searchResults").html( "search results" );         })         .error(function() {             $(".searchResults").html( "no results" );         });     }      My questions are (while keeping security and best practices in mind): Is it bad practice to pass the query string values to my javascript function from within the body? I initially did this because I had the impression that it was not a good idea to extract query string values using javascript. Maybe I'm wrong there. Should I be extracting the query string values from the $(document).ready function, and then calling the appropriate javascript functions from there? What is the appropriate way to do that (htmlspecialchars equivalent)? Keep in mind that within my javascript code, I use $.getJSON to call another server side function (in PHP) that can reject anything insecure. Any insight would be greatly appreciated.


Switching from abstract class to interface

I have an abstract class which has all abstract methods except one which constructs objects of the subclasses. Now my mentor asked me to move this abstract class to an interface. Having an interface is no problem except with the method used to construct subclass objects. Where should this method go now? Also, I read somewhere that interfaces are more efficient than abstract classes. Is this true? Here's an example of my classes               abstract class Animal {         //many abstract methods         getAnimalobject(some parameter) {             return //appropriate subclass          }     }          class Dog extends Animal {}     class Elephant extends Animal {}


Nested Entities and calculation on leaf entity property - SQL or NoSQL approach

I am working on a hobby project called Menu/Recipe Management. This is how my entities and their relations look like. A `Nutrient` has properties `Code` and `Value` An `Ingredient` has a collection of `Nutrients` A `Recipe` has a Collection of `Ingredients` and occasionally can have a collection of other `recipes` A `Meal` has a Collection of `Recipes` and `Ingredients` A `Menu` has a Collection of `Meals` The relations can be depicted as ![Menu Entities and Relationships](http://i.stack.imgur.com/Un7Pr.png) In one of the pages, for a selected menu I need to display the effective nutrients information calculated based on its constituents (Meals, Recipes, Ingredients and the corresponding nutrients). As of now am using SQL Server to store the data and I am navigating the chain from my C# code, starting from each meal of the menu and then aggregating the nutrient values. I think this is not an efficient way as this calculation is being done every time the page is requested and the constituents change occasionally. I was thinking about a having a background service that maintains a table called MenuNutrients (`{MenuId, NutrientId, Value}`) and will populate/update this table with the effective nutrients when any of the component (Meal, Recipe, Ingredient) changes. I feel that a GraphDB would be a good fit for this requirement, but my exposure to NoSQL is limited. I want to know what are the alternative solutions/approaches to this requirement of displaying the nutrients of a given menu. Hope my description of the scenario is clear.


How was the first Malbolge interpreter tested?

According to Wikipedia, Malbolge was so difficult to understand when it arrived that it took two years for the first Malbolge program to appear. If this is true, how was the first Malbolge interpreter tested (to check if it did the right thing when a Malbolge program was given)? Was it tested at all?


Correcting indentation

I work for a multi-national I.T. services company. I'd thought they'd be applying good development practices but they aren't. One example is the source code base for a Java project that is currently being developed for a client. It's full of incorrectly indented code. There's mixtures of tabs and spaces on lines (no they're not using the GNU formatting style) as well as 2 or 3 or 4 space indents. Everywhere else I've worked people have agreed to a fixed indentation coding standard and stuck with it, so that's why I find this project an anathema. How do I diplomatically get them to indent properly?


Thoughts and Best Practices on Static Classes and Members

I am very curious as to thoughts and industry best practices regarding static members, or entire static classes. Are there any downsides to this, or does it participate in any anti-patterns? I see these entities as "utility classes/members", in the sense that they don't require or demand instantiating the class in order to provide the functionality. What are the general thoughts and industry best practices on this? See the below example classes and members to illustrate what I am referencing.               // non-static class with static members     //     public class Class1     {         // ... other non-static members ...              public static string GetSomeString()         {             // do something         }     }          // static class     //     public static class Class2     {         // ... other static members ...              public static string GetSomeString()         {             // do something         }     }      Thank you in advance!


A 'task' system which has an ending, to get ready for next task

I want to make a system, so that there are certain tasks. For example, let's talk about a game. I want to make it so there are 100+ tasks doing different things, but when the player's magic level is 5, it will do the magic task, if the player's fighting skill is level 5, it will fight. I have that already, however here is the catch. I want to make it so once the task executes, it will have an 'ending'. So, it will do something before it finally gets killed. My code so far:               for (GameTask a : s.gameTasks) {         if (a != null) {             if (a.validate()) {                 a.execute();             }         }     }      It will loop all the tasks and execute them, however how can I implement an 'ending' to it, so that it will get ready for the next task? I hope I have written it clearly as English is not my first language. tl;dr, I want to add an 'end' to each task so that it can be killed and can be ready for next task.


Data base structure of a subscriber list

I am building a application that allow different user to store the subscriber information   * To store the subscriber information , the user first create a list For each list, there is a ListID. `Subscriber` may have different attribute : email phone fax .... For each list, their setting is different , so a `require_attribute table` is introduced. It is a bridge between subscriber and List That store `Listid, subid, attribute, datatype` **That means the system have a lot of list, each user have their own list, and the list have different attribute, some list have email , phone , some may have phone, address, name mail.. And the datatype is different, some may use 'name' as integer, some may use 'name' as varchar**   * attribute means email phone, it is to define for `which list have which subscriber attribute`   * datatype means for each attribute, what is its datatype              Table :subscriber :             Field :subid , name,email          Table :Require Attribute:          Field : Listid ,subid , attribute, datatype      The attribute here is {name, email} So a simple data is               Subscriber: 1 , MYname, Myemail          Require Attribute :           Listid , 1 , 'email', 'intger'           Listid , 1 , 'name', 'varchar'      I found that this kind of storage is too complex to handle with, Since the subscriber is share to everybody, so if a person want to change the datatype of name, it will also affect the data of the other user. Simple error situation: Subscriber:               list1,  Subscriber 1 , name1, email1          list2, Subscriber 2  , name2 , email2          Require Attribute :               List1 , Subscriber 1 , 'email', 'varchar',               List1 , Subscriber 1  , 'name', 'varchar',                Listid , Subscriber 2 , 'email', 'varchar',                Listid , Subscriber 2, 'name', 'integer',       **if user B change the data type of name in require attribute from varchar to integer, it cause a problem. because list 1 is own by user A , he want the datatype is varchar, but list 2 is won by user B, he want the datatype to be integer** So how can I redesign the structure?


What type of problem is this?

Business Analyst creates a requirement. Requirement implemented by developer. BA performs QA. Bug report includes various bugs that were never requirements. E.G. A requirement is made to display a report. The report is displayed. In QA, the analyst see's that a user can enter invalid data. The invalid data makes the report invalid. Per the requirements, an error message is displayed. The analyst decides that they want the previously run report to have its data cleared. Currently, when entering into an invalid state the system displays results from the previous report along with an error message. In this case, the problem is that we are in an error state. The error state requires an error message, but is otherwise undefined. Is this "bug" scope creep, poorly defined requirements, lack of an overall business process for error management, lack of technical foresight on part of the BA/Dev, a valid request or other? How can you minimize these types of problems? **Other details (specific to this app)**   Web app. Persistent State is an overall part of the design (thus the reason you see the report still displayed). There are little to no HTTP POST/GET operations performed outside of AJAX. Navigation menu changes pages without full postbacks. Instead, perform HTTP GET to load HTML/JSON into portions of the web page on click.


Overload or Optional Parameters

When I have a function that might, or might not receive a certain parameter, is it better to overload the function, or to add optional args? If each one has it's ups and downs - when would I use each?


How can I stop myself overwriting member variables with 'new' ones?

The bulk of my programming experience has been with C++ and (shudder) FORTRAN (I'm a scientist not a programmer as such, but I do my best). I've recently started using python extensively and find it great. However, I just spent a frustrating few hours tracking down a bug that turned out to be caused by me creating a new object member in a function, i.e.               def some_func(self):         self.some_info = list()      but, I had already created elsewhere the member `some_info` for this object for a different purpose, so bad things obviously happened later on, but it was tricky to track back to here. Now obviously in a language like C++ this is impossible to do, since you can't just create object members on the fly. Because I'm used to the language taking care of this, I don't have a well developed procedural discipline to prevent me abusing the freedom that python (and other dynamically typed languages) provides. So what is the best way to prevent this kind of mistake when using languages like python?


What causes overtime and how can it be avoided?

Today, my manager **_told_** me that I must work over time to make up for a lack of planning and project management. Instead of incentivizing this unpaid mandatory overtime, my manager has made it clear I have no choice in the matter. This isn't a single project. We currently have a dozen projects all on the go at one time, and I simply can't get them all done. Therefore, I must work overtime so we don't have to push deadlines.   * Is this a sign of an ignorant or disrespectful manager, or simply an inexperienced one?   * I'm in this position because of a lack of planning and project management (I think). How might I avoid this in the future? I'm no Project Manager, it isn't my strength.   * What are good ways to get an employee to work overtime if you can't directly pay them? Good incentives, etc. From what I hear, gaining your employee's respect is the single best way to get your employees to work over time, although you should never make a habit of it.


For nodejs what are best design practices for native modules which share dependencies?

Hypothetical situation, I have 3 node modules all native, A, B, and C.   * A is a utilities module which exposes several functions to javascript through the node interface, in addition it declares/defines a rich set of native structures and functions   * B is a module which is dependent on data structures and source in A, it exposes some functions to javascript, in addition it declares/defines native structures and functions   * C is a module which is dependent on data structures and source in A & B, it exploses some functions to javascript, in addition it declares/defines native structures and functions So far when setting up these modules I have a preinstall script to install other dependent includes, but in order to access all of another modules source what is the best way to link to it's share library object (*.node) ? Is there an alternative best practice for native modules (such as installing all source from other modules before building that single module)? Reply


How do you get a client to understand the importance of a project lifecycle?

Situation is I have a number of in-house clients who continue to have trouble grasping the concept of defining clear requirements for a project and committing to them. Unfortunately my job situation is that I can't decline such projects, and I am often forced into situations that I can tell are doomed to scope creep (or worse) from the very start. Telling them that detailed requirements are vital and why we need them (using examples of past troubled projects due to this) have not helped. I am looking for techniques, tips, words, etc that you might use to motivate or illuminate clients in such situations to the necessity of requirements,setting milestones, etc. I am only a developer, and not a manager.


ASP MVC Action parameters all strings vs explicit type

A colleague and I were developing an ASP.NET MVC project and during this we created a new action method to handle one of our views. I initially started created the action like so:               public ActionResult Index(int id, int numberOfAssessments, int age)     {         // do stuff     }      However when I started writing we had a little discussion: **Him** : _"Why am I making these ints, they should all be strings"_ **Me** : _"Well they are ints so it makes more sense to make them strongly typed and so stop potential errors later in the code block"._ **Him** : _"Back what if we wanted to change the id to a alpha-numeric representation. We know have to change this signature everywhere where if it was a string it would already handle this"._ **Me** : _"It's not a string now and we don't have any plans for making it a string at this moment though"._ We didn't really decide explicitly what to do but it did get me thinking. **Question** : Should parameters to Action methods be all strings if that is going to make it more flexible in the future, or should they be specific to their type so that we can leverage MVC binding and error handling? What is the best or accepted practice in these situations. Are there too many considerations to take in for any definitive answer?


Taking Object Oriented development to the next level

Can you mention some advanced OO topics or concepts that one should be aware of? I have been a developer for 2 years now and currently aiming for a certain company that requires a web developer with a minimum experience of 3 years. I imagine the interview will have the basic object oriented topics like (Abstraction, Polymorphism, Inheritance, Design patterns, UML, Databases and ORMs, SOLID principles, DRY principle, ...etc) I have these topics covered, but what I'm looking forward to is bringing up topics such as Efferent Coupling, Afferent Coupling, Instability, The law of Demeter, ...etc. Till few days ago I never knew such concepts existed (maybe because I'm a communication engineer basically not a CS graduate.) Can you please recommend some more advanced topics concerning object oriented programming?


CSS3 shorthand properties

Working on my own I tought I need to learn that css3 shorthand properties, because - as I know now, it affects website's loading time, so I need to optimize it a little bit. I was thinking - is there any order how to write property values, when using shorthand prop's? For example: `font: 1em/1.5em bold italic serif`


Scenarios for differences between UICulture and Culture

In .NET there are two "culture" values, UICulture and Culture. The first one is for localized texts on the UI, while the latter sets the culture for date and number formats. I can't come up with any reason or scenario for those two values to be different. Is there some reason to do so?


Metrics / Methodology for estimating resource utilization for software in planning stage

I'm looking for approaches to estimate the resource utilization of an (web-)application in a JEE environment. The overall target is to get a forecast for hardware/software requirements while the application is still under development or even in planning stage.   Is this task too complex (many different factors) to get a fairly reliable proposition without spending too much time?


External file (images, sounds) naming convention at Xcode

* What is better naming conventions at Xcode regardng External File (images, sounds) etc?   * Is there any guideline from vendor Apple?   * As we store our projects at SVN, is there any complicity from Hosted Server (we use Linux + Server SVN ) ?


What is the difference between K&R and One True Brace Style (1TBS) styles?

I have read the Wikipedia article on Indent Styles, but I still don't understand. What is the difference between K&R and 1TBS?


What factors influence you to try out a new framework or tool?

I'm in the process of putting the final touches on an open-source framework that I hope to release in the next few months. It's something that I'd like to develop a community for and so I'm curious about what factors influence your decision to use a new framework or tool and why. Some of the specific things I'd like to know more about (feel free to add to this):   * Types of documentation/tutorials/instruction   * Community support (comments/forum)   * Updates (blog/social media/feeds)   * Look and feel of the project website design   * White papers/testimonials   * A big feature list   * Community size   * Tools   * Ability to contribute   * Project test coverage (stability/security)   * Level of buzz (recommended by friends or around the web)   * Convincing marketing copy Ideally, I'd like to have all of the above, but what specific features/qualities will carry greater weight in getting programmers to adopt something new? **What says, 'This is a professional-grade project,' and what are red flags that keep you from trying it out?**


Planning Before Starting a Project

How much planning should one do before starting a project? Should they have everything already planned when they begin coding or should they just get a basic idea of what they want and then make things up on the fly? For instance, I want to create a YouTube client that allows for streaming videos and for downloading multiple videos simultaneously (similar to Minitube). I know what I want the interface to look like when the program is first opened. Is this enough for now? Should I create this and then plan the next step or should I continue planning? How much planning is enough?


What traits do the best managers you've worked for have in common?

I have been listening to Scott Hanselman and Rob Conery's podcast, This Developer's Life. In the latest episode, they discuss personality traits: > 1.0.4 - Being Mean. > > What makes people mean in our industry? What about aggressive? Confident? > What's the difference? Would you rather have a drill sergeant for a boss, or > a zen master? We talk to Cyra Richardson and Giles Bowkett. It got me thinking, what traits did the best managers _you've_ worked for have in common? EDIT: Just to clarify, as there have been a few close votes, I'm interested in whether there are traits common to managers of developers that are not necessarily those traits that a manager of some other profession requires. As for whether this is programming related or not, well I don't want to ask this question on a site that isn't about programming because, frankly, I'm not as interested in what people who make cans of soup for a living want from their managers as I am interested in what _developers_ want from their managers.


Do you handle Out-Of-Memory conditions?

What do you do when `malloc` returns 0 or new throws exception? Just halt or try to survive OOM condition/save the user's work?


How to handle large scale js+jquery projects using well written, Object-Oriented JavaScript and jQuery code?

I love the whole user experience/interface thing and put a lot of jQuery and JavaScript (pure JavaScript for HTML5 stuff, like canvas, file API, etc). The problem I face now is that my codes are growing large, 3-4 files per project with each file around 1000 lines of code, and maintaining and extending them is becoming a headache. I know that Object-Orientated JavaScript coding can solve a lot of my problems. I know the basic concepts of Object-Orientated Programming, have done a decent amount of it in C++, Java and Python in school and college projects. I want to read some good examples large scale OO programming in JavaScript (and jQuery), or if possible, some book specifically on writing big OO programs in JavaScript. EDIT1: Checked out backbone.js, guess thats what i needed, will be sure once i use it in my next project, thanks Raynos, also, my question should have been about handling large js projects, and not what it is, sry


Finding a new job when my skillset isn't matching the job ads

I am a C++ programmer and have worked on various web apps using Perl, Ruby, etc.. I have decent a knowledge of Java as well. The problem I face while applying for jobs is companies have specific requirements like, "Experience with C# 3.5/4. Should have experience experience building web apps with ASP.NET". What should you do in these situations?   1. Not consider these companies and look for companies with your expertise?   2. Just put that in your resume, and learn the technology before interviews? After all, how hard is it for a developer to wrap their brains around new languages?   3. Try to convince the employer in the cover letter that you are good at one thing but can a learn a new language a tool pretty easily?   4. Something else?


Priority list of tasks stored in a database

I am trying to think of the best way to do the following: I have a list of tasks stored in the database. A task has a priority assigned to it. You can change the priority of a task to reorder the order they should be carried out. I am thinking of something very similar to Pivotal Tracker. So imagine we had the following:               1 Task A     2 Task B     3 Task C     4 Task D     5 Task E      We decide that E is now the most important task               1 Task E     2 Task A     3 Task B     4 Task C     5 Task D      I need to update all 5 tasks to give them a new priority. If Task B then becomes more important then A I would I would have               1 Task E     2 Task B     3 Task A     4 Task C     5 Task D      I need to update Task B and A only. What ways would go about structuring this in a DB? I imagine that you would have a differnt projects stored in the same table that would have there own weight. Would it be better to point a Task that takes place after it (a bit like a link list). This is just a brain dump really. Just was wondering how you would go about implementing something like this.


How to develop custom functions on top of Ejabberd?

I'm developing a real time chat app. After searching around for a while, I found Ejabberd and Erlang is a good option. The question is the Ejabberd is not providing all the functions I need. I need some custom features such as location based matching and anonymous login. So how to development custom functions on top of Ejabberd? write modules for it? or develop another standalone server app (web or other kind of server app) to interact with it? Thanks!


what are the benefits of closure, primarily for PHP?

I am beginning the process of moving code over to PHP 5.3 and one of the most highly touted features of PHP 5.3 is the ability to use closures. My understanding of closures is that they allow anonymous functions, can be assigned to variable names, and have interesting scoping abilities. From my point of view the only seeming benefits in real world applications is the reduction of clutter in the namespace because closures are anonymous. Am I wrong in this? Should I be trying to put closures wherever I code? **EDIT** : I have already read this post on Javascript closures.