Where to look for challenging jobs with a relaxed atmosphere?

I'm a dev at one of the big-name tech companies. I like the job for many reasons:   * I do interesting work on a cool product   * I solve challenging problems and use a lot of high-level skills (quantitative, creative, writing, presenting)   * It pays well The problem is that I feel I need a more relaxed atmosphere (shorter hours, less performance pressure, and more flexibility), in order to free up time for other pursuits and reduce stress. The ideal would be a job that's around 30-35 hours a week, where there is flexibility to work more or less in a given week. **Can anyone suggest where to look for a job like this, where I wouldn't have to sacrifice too much on the above points?** (Obviously I would have to sacrifice pay.) My employer does not generally offer part-time employment. The closest thing I can think of is when I did summer internships at my university's CS department. The work was very intellectually challenging, but if I needed to go home a couple hours early or get flexibility on a due date, nobody batted an eyelash. However, I'd like to find out if there are alternatives to academia since from what I've seen the pay there is a gigantic drop from what I'm currently making. I've done freelance development before, but I do like that as an employee of a large company I have a lot of things taken care of for me (e.g. benefits and guaranteed stable employment).


What is the best programming language to do crypto running time measurement?

I am trying to measure the running time of different crypto algorithm. e.g. how long it takes to encrypt/decrypt a block of plaintext. May I ask if `C` with `OpenSSL` is the best PL to do this?


How should I behave as a developer in a project that's headed for failure?

I am a developer in a 5-member team and I believe our project is headed for disaster. I'll describe why in a moment, but my question is: how should I behave? The deadline is in 1.5 months, and I feel no matter what we do, this project will fail. I'm of the opinion that we should just terminate the project and stop wasting our time, but politically I think it's impossible for our manager to do that. What should I do in this case? Should I put in extra effort, or should I just take it easy? And what should I say to the manager? Reasons this project is headed for failure:   * With deadline approaching many of the must-have features are not finished    * Application is unstable and very difficult to use    * System is very convoluted, code very hard to understand, very difficult to change - Data model is too driven by a complex relational database (100+ tables)   * Unclear leadership; the manager responds to new information with major changes    * Almost no automated tests or unit test    * Heavily depends on other systems, but no integration tests yet  In fact, we actually just inherited this project (along with the mess) around 1-2 months ago from another dev team under the same manager, who has worked on it for a few months.


What's the formal name of this diagram?

![enter image description here](http://i.stack.imgur.com/FmuRO.gif) I'd also want to know how can I draw them.


Choosing the type of Index Variables

We use Integer type represent index variables most of the time. But in some situations, we're forced to choose               std::vector<int> vec;     ....          for(int i = 0; i < vec.size(); ++i)     ....      This will cause the compiler to raise the warning that mixed use of signed/unsigned variables. if I make the index variable as `for( size_t i = 0; i < vec.size(); i++ )`, (or an `unsigned int` )it will sort out the issues. When it come more specific to use windows types, most of the Windows APIs are dealing with DWORD (which typedef-ed as unsigned long). So when I use similar iteration, will again cause the same warning. Now if I rewrite it as               DWORD dwCount;     ....          for(DWORD i = 0; i < dwCount; ++i)     ....      I find this a bit weird. It might be the problem withe perceptions. I agree that we are supposed to use the same type of index variable to avoid the range problems can happen with the index variables. For e.g if we're using               _int64 i64Count; //      ....          for(_int64 i = 0; i < i64Count; ++i)     ....      But in the case of DWORD, or unsigned integers, are there any problems in rewriting it as               for(int i = 0; (size_t)i < vec.size(); ++i)      How most of the people are working with similar issues?


Multiple Joins or Simple Readable Database Calls

Curious how other developers feel about this. I come across some pretty nasty sql joins, as we all do I'm sure. I would prefer making more database calls for the sake of readability and simplicity rather than have a large SQL statement to maintain; about 3 - 4 joins. For the performance argument, I will give up a little performance for readability. For example: make the first call, filter the data, and then query the second table, and so on What is your preference?


Does it hurt to learn bits of many programming languages?

I started my programming career with BASIC, during 9th grade. I learned a bit of BASIC by writing simple programs to add, subtract and to print. Then I went to the university and took Computer Information and Systems Engineering. In the first year I was taught C, and I have good command over it. Next I learned C++ in the second year. It just taught me some knowledge of OOP. Now I am doing PHP (along with HTML). I have not mastered C++, BASIC or PHP. I am now planning to move to mobile development. But I feel that I have not covered everything in the languages I learned. Does it really matter?


What is the iOS equivalent of Michael Hartl's Rails 3 Tutorial?

I'm a newbie programmer and I've been reading Michael Hartl's Ruby on Rails 3 Tutorial. I'm enjoying the book very much. It's easy to follow and doesn't assume I know much. I'd also like to learn to code iOS apps (both iPhone and iPad) and would appreciate any recommendations on books or courses that could help me to do so. Thanks in advance for the assistance! Eddie


Using private vs company devices for development at work

I'm employed at a mobile app development company since 4 months as Android developer. It's my first job as developer. Currently I'm using my two private Android devices for development. Is it common practice that developers use their own hardware devices for development in mobile development companies, or should I ask for company devices?


Bringing your previous intellectual property to your employer

Assume that in my free time I have developed library X before signing a contract or being employed by company A. I then sign a contract with company A and begin working. It becomes apparent that library X will be incredibly useful and save the company lots of time and money. What is the industry standard practice in this area in terms of bringing this code into the company? Would it be possible to license library X to company A?


Can an email exist in multiple message boxes

I'm in the process of writing a mail server stack and it's a fairly critical design decision as to whether a unique message can appear in more than one message box. Simple cases are easy to make a decision on (e.g. a message obviously cannot exist in the "Inbox" and the "Trash" mailbox) but a more subtle situation like being in the "Work" mailbox and the "Trash" mailbox is a little trickier. So:   * Is it easier to assume clients won't notice if a unique message appears in more than one mailbox, and throw a hissy fit.   * Or use tagging and only have the message exist in the major mailboxes and use tagging to identify other attributes. In clients that don't support tags (quite a lot), fake the message's uniqueness (not difficult on server end) and display the tags as if they we're their own mailbox    * Or is it cardinal sin to have a message in multiple mailboxes in the first place.  I'm specifically looking for the broadest possible client friendly solution as I'm making a client independent server. Unique message = Unique Identifier on the server (alpha numeric usually), all other headers and body components could by freak coincidence, or by hitting send twice in quick succession be duplicated. If I was to fake the Identifier it would only be to face the client, it would be linked back to the original again on the server for any edits. **Edited for clarity**


Structuring an input file

I am in the process of structuring a small program to perform some hydraulic analysis of pipe flow. As I am envisioning this, the program will read an input file, store the input parameters in a suitable way, operate on them and finally output results. I am struggling with how to structure the input file in a sane way; that is, in a way that a human can write it easily and a machine can parse it easily. A sample input file made available to me for a similar program is just a stream of comma-separated numbers that don't make much sense on their own, so that's the scenario I am trying to avoid. Though I am giving the details of my particular problem, I am more interested in general input-file structuring strategies. Is a stream of comma-separated values my best bet? Would I be better off using some sort of key:value structure? I don't know much about this, so any help will probably put me in a better track than I am now.


Should one comment differently in functional languages?

I'm just getting started with functional programming and I'm wondering about the correct way to comment my code. It seems a little redundant to comment a short function as the names and signature already should tell you everything you need to know. Commenting larger functions also seems a little redundant since they are generally comprised of smaller self-descriptive functions. What is the correct way to comment a functional program? Should I use the same approach as in iterative programming?


Why delete method/field/function refactoring doesn't exist in Eclipse?

An operation in an interface is obsolete so I decided to delete it. It seems that there is no automatic support for such a "refactoring" in Eclipse. For me is a refactoring operation since the behavior of the code will be preserved since nobody (tests, client apis) will notice that the operation was removed. In Eclipse, in Java code, on an method in an interface I have the following options: rename, move, change method signature, inline, extract interface, extract superclass, use supertype when possible, pull up, push down, introduce parameter objet, introduce indirection, generate declared type. Is there any reason for which a delete method/field/function refactoring doesn't exist?


How to configure simple game AI setting with jtable

I'm developing an application that has methods of this kind:               attackIfIsFar();     protectIfIsNear();     helpAfterDeadOf();     helpBeforeAttackOf();      etc. The initialization of my application for n players is something like               player1.attackIfIsFar(player2);     player2.protectIfIsNear(player4);     player3.helpAfterDeadOf(player1);     player4.helpBeforeAttackOf(player3);      etc. I don't know how to configure a jtable that that can allow me to set the equivalent of this code-block In others words I need simply a way to create a jtable with 3 column and n row, were I can set in the column 1 and 3, the player, and in the central column one of the available methods that each player on the column 1 must invoke on each player of column 3


At what point should you switch to release build?

One of the practices set out in Jez Humble's Continuous Delivery is that you should build one package and then release it to each environment you deploy to, so that the deployment and the artifacts have themselves been tested multiple times before going to production. I fully support this idea. On the other hand, debug-mode builds that give you stack traces with line numbers are incredibly useful in test environments, as is the ability to remote-debug. But, you want to send a release build to production. So, for people following the first principle, at what point do you switch from debug to release builds? Is it before the first deployment to a test environment, figuring the cost of losing debug mode is worth paying to ensure you are testing the actual release candidate early? Or do you build again at some point in the promotion process, figuring that you'll trust the build process over the software? Or do you just screw it all and deploy debug versions to production? Note: I know this doesn't really apply to interpreted languages because you can usually flick the switch in configuration rather than doing it at build time.


Google Maps-based desktop application

I want to build a desktop application which has google maps embedded to it. This app should have a thread to read coordinate data online a usb microphone to use. This application will move the google map markers to their new locations based on the data retrieved from online connections on each refresh. As far as I know gmaps has a javascript API so the first idea in my mind was to embed this mapview into a java applet. So the application will run on a browser. I'm not sure if this will work. Do you guys have any idea about this or any other advices you might have?


Modeling Associations

I am working on the design phase of a paper folding project. I have a few queries in this. Part of the problem statement says " A web can contain one or more ribbons in it. It can also contain a group of ribbons folded together inside it." How do you model the association for this? I found two solutions i) Maintain two associations, one between the web and ribbon and the other between the ribbon   and the Group class. This way, the web contains only ribbons and when you process the ribbons, you'll have to check whether it is part of a group. Note that the behaviour of the ribbon will change if it is part of a group ii) Introduce a new class called Childelemnt and associate it to web. Both Ribbon and Group will share the interface of Childelement. Which one do you think is better? If you have any other solution, please let me know. Thanking you all in advance, Pradeep


Using a SetProperty method to prevent accidental changes to a property

Is it good/bad practice to do the following:               public class MyClass {       public MyType MyProperty { get; private set; }            public void SetMyProperty(MyType myProperty) {         MyProperty = myProperty;       }     }      My intention is to prevent `MyProperty` from being accidentally changed outside the class. However, it can be changed if needed. Also, if `MyType` is a reference type, then will the `private set` prevent, for example:               instanceOfMyClass.MyProperty.SomeField = 2;      In other words, will it make `MyProperty` and all its members readonly, or just the reference to `MyProperty`? Sorry if this seems an unintelligent question; I'm afraid I'm a beginner.


Ideal programming language learning sequence?

What do you think? What is the ideal programming language learning sequence which will cover most of the heavily used languages and paradigms today as well as help to grasp common programming basics, ideas and practices? You can even suggest learning sequence for paradigms rather than languages. N.B. : This is port of the question I asked in stackoverflow and was closed for being subjective and argumentative.


How is IntelliJ better than Eclipse?

I know there have been questions like What is your favorite editor/IDE?, but none of them have answered this question: Why spend the money on **IntelliJ** when **Eclipse** is free? I'm personally a big IntelliJ fan, but I haven't really tried Eclipse. I've used IntelliJ for projects that were Java, JSP, HTML/CSS, Javascript, PHP, and Actionscript, and the latest version, 9, has been excellent for all of them. Many coworkers in the past have told me that they believe Eclipse to be "pretty much the same" as IntelliJ, but, to counter that point, I've occasionally sat behind a developer using Eclipse who's seemed comparably inefficient (to accomplish roughly the same task), and I haven't experienced this with IntelliJ. They may be on par **feature-by-feature** but features can be ruined by a poor user experience, and I wonder if it's possible that IntelliJ is easier to pick up and discover time-saving features. For users who are already familiar with Eclipse, on top of the real cost of IntelliJ, there is also the cost of time spent learning the new app. Eclipse gets a lot of users who simply don't want to spend $250 on an IDE. If IntelliJ really could help my team be more productive, how could I sell it to them? For those users who've tried both, I'd be very interested in specific pros or cons either way.


What happened to Concurrent C?

I recently checked out a fantastic book from my college library. It is a bit old at 1989, but the language it describes sounds rather nice. And even while I may not be using it soon, I wanted to research their paradigm some more. So I tried to wiki Concurrent c. nothing. I can't find any references to it on the internet really either. searching for "Concurrent c" mostly points you to that one book. (Stack overflow doesn't have even one reference.) Does anyone know where I might find some history on this programming language or other resources?


What is the name of this particular kind of over-engineering?

When faced with (even a small) project, I tend to fall into the following bad practice. I think about the structure of the problem. Then I create some base classes, derive from them and then derive from those my actual useful classes. I almost never have a chance to write code inside those base classes, they are just too broad for the concrete problem I am solving. The problem is not limited to inheritance. If I need to do something very simple, I make a class to do it, then a class to hold an instance of the "doer", and then a Manager to ... call methods inside the wrapper of the "doer". IMHO this is different form directly breaking YAGNI as I do not build unnecesery features for the end user. What term best describes this anti-patern? Any tips how to change my design process in order to avoid it?


Factory for arrays of objects in python

Ok, the title might be a little misleading. I have a `Window` class that draws widgets inside itself in the constructor. The widgets are all of the same type. So I pass a list of dictionaries, which contain the parameters for each widget. This works quite nicely, but I am worried that the interface to callers is obfuscated. That is, in order to use `Window`, one has to study the class, construct a correct list of dictionaries, and then call the constructor with only one parameter - widgets_params. Is this good or bad design? What alternatives does the python syntax provide?


Is Clojure development required to be open-source?

This question could be generalized to any language where the language development is open-source, potentially, but I'm most curious about Clojure specifically. If Clojure (as a language) is open-source, licensed by the Eclipse Public License, which per this GitHub side-project requires derivative works to disclose source, must any application written _in_ Clojure be distributed with source? Or must only derivative language projects (e.g. Continjuation or something) disclose the source? Or do I have a faulty major premise somewhere in there?


What the usual or accepted cost of a support contract for custom software?

For custom built web based software, what is the industry standard or generally accepted cost for support and maintenance of the software? Is it usual to be expressed as a % of the original development cost, and if so what is the usual % amount?


Where to Start When Making a Web Application on Your Own

I've been assigned an in-house web application that is basically an Employee and Project Management System. I'm getting confused as to where I should really start with this assignment (I mean I'm my own development manager and I really don't have experience with making a project alone) and I'm hoping that you guys could share your experiences when you were given an assignment/project to build by yourself. Thanks


Wiki-like tool for writing specifications and documentation

I am looking for a wiki or wiki-like system for writing and managing specification and documentation for a software project. I know there are lots of wiki-implementations available, but are there some that are especially well-suited for this kind of task? Actually it doesn't have to be a wiki, just a system that makes it easy to write and navigate specs and documentation, and which support change tracing.


Choosing the right resources

Once I heard that a good book on any programming language cannot be short, so the number of pages is the first criterium when choosing a tutorial. The statement was half a joke, but it has some truth in it. There are tens and hundreds of books available for most popular programming languages, frameworks and technologies, and it is hard to choose one. So that _dummy condition_ is the first one to check. Are there any criteria to help choose the "right" tutorials? What is the first (or probably the second) thing to pay attention on when choosing a technical tutorial?


What is the necessity to go for lambda functions and expressions in C++?

1. What is the necessity to use lambda functions and expressions in C++?   2. Can you explain or show through examples how to use lambda functions and expressions?   3. I already gone through the related Wikipedia page, but I got only few ideas regarding this. Are there more resources I can read? May I know which compilers will fully support this lambda feature? Some answers I found are VS10 and GCC5 compilers. Is there any online compilers which are supporting this feature?


when to, and benefits, of replacing existing message passing with JMS in project?

I have moved to a new project and as the only 'software guy' I'm welcome, and expected, to suggest design improvements to the existing code (code just got out of prototype phase and needs extended to final releasable version; plus adding functionality) The code has multiple stand alone components which are suppose to run in concert, but each one can be rebooted on it's own. They are passing messages between these daemons via a few hand written classes which implement their own server with message queue's. It works well enough, the project made it passed prototype phase and while stability is one of their biggest long term focuses it's not notoriously unstable; just not quite up to par for a final release. Still, ever time I see the code all I can think is "I would have done this using JMS." If I went back in time to their implementation days I would have told them to do this in JMS from the start; and I am very tempted to insist on that now. Only problem is that, even if reinventing the wheel was suboptimal at the time, what they have mostly works now and I would hate to throw out large chunks of code. I have no doubt if we kept their message passing logic I would have to spend some time working on it; I'm not certain it is 100% reliable; there are some minor data-races that they get away with because they system should be able to recover even if it happens, some 'code smells' I want to investigate further etc etc. Still, replacing the whole system with JMS would be a pretty big overhaul. Require writing allot of new code, some debugging to fix issues they already ran into and corrected with their home brewed system, and ultimately add a dependency on JMS when we release this project which may be undesirable. To give a slightly better idea of the system as it is; it's mostly a direct pipeline with two way asynchronous calls. Each separate part of the system (called daemons) at most speak with two other daemon, the one in front of it in the pipeline, and the one behind it. Each daemon will pass requests further 'down' the pipeline to the low level architecture and want some response back (but doesn't block waiting for it), in addition asynchronous messages must be able to propagate back up the system. Multiple people can be making requests at once; but we don't expect an absurdly high number of total messages. Each customer will generate messages in a small burst, but the bursts aren't huge and I don't _think_ this has to scale up to an absurdly high number of customers. Lost of a message would likely result in inconsistent state; lost messages are quasi-detected currently, but nothing really done to 'clean up' when it happens; but the system is basic enough that inconsistent state isn't likely to break things as horrible as some systems could (plus we have our own tiny closed system, probably aren't going to lose messages). The current communication code is generic, any daemon can send any message to any other; and we just trust each daemon only sends messages to the correct daemons and that no daemon sends a message of a type another daemon doesn't know how to happen (all messages are enumerated, but some only are viable when sent to specific daemons) So the question is, can I justify a switch to JMS? I will feel more comfortable with stability if I know were using an enterprise system, and I think it would allow some of my other "crazy, probably never get around to implementing, but would be so cool" ideas a bit easier to implement later. However, we have a small team and can't possible do everything I would love to do anyways. Will JMS provide enough benefit to warrant the cost of rewriting mostly-working code (mostly working because we don't have an obvious "this doesn't work!" example, I know from code review that there are minor issues a few 'smells' that I need to look into further, and basically that it's a decent but no-where close to enterprise level, but the stuff I am certain I have to address wouldn't take as long as writing the JMS logic, much less testing and debugging). How 'bad' is it to create a dependency on an external system like JMS when we currently can run without it? Are there other useful advantages to JMS I'm not seeing (guaranteed message delivery seems a big one to me, but not sure just how much of a benefit that will be yet for this project) Incidentally, one of our eventual "long term, cool to have, were see if we get around to it" goals would be to replace the current use of SQL calls to fetch data by storing everything in memory. If we do store in-memory we will need very reliable message passing to keep state consistent between multiple daemons, and my inclination right now is that something like that should never be tried without the something like JMS. The state wouldn't change very often, but when it does change were have to stay consistent, worry about data race etc. We may not do that at all, would JMS make it substantially easier to keep consistent state and handle data-races, or will I still be doing the same logic in either case? Are there certain things particularly prone to failing with quickly written message passing systems I should be looking for explicitly?


What's the right way to work with a graphic designer?

Recently, we worked with a graphic designer (arranged by the client) to provide the skin for a Django+Bootstrap application we had built. The designer provided a series of static images of the new layout, along with a document describing some technical attributes (font sizes, colours, a few dimensions etc). It turned out to be incredibly time consuming to implement this. Although the whole site was basically a front page, an index page, and half a dozen detail pages, I spent at least 5 days just implementing the CSS and HTML changes. So I'll go out on a limb and call this _The Wrong Way_. My basic approach was:   1. Compare the static image and current rendering, and notice a difference.   2. Guess what change would be need in the CSS/HTML   3. Make that change   4. Go to step 1. Some of the particular issues were me not understanding that the design included a change from 8 columns to 12, some images provided in the wrong format (.png's can render differently on different browser/platform combinations), hassles trying to undo Bootstrap's styling, the usual CSS wrestling to achieve pixel perfect rendering etc. And occasionally I had to reorganise the HTML templates to get a certain behaviour. What's the right way?


How to handle deleting record with associated records?

this is not a technical question but rather about the right logic on handling delete with foreign key constraint. First of all, Im very new to programming and a dummy about software engineering. Im still a first year student. In my exercise app, I cascaded the record with OneToMany relationship with other records. In other words when I delete the record, Hibernate will automatically delete the associated records. My problem is, my teacher told me that Cascading is not right. He said that the user must delete first the associated records and he didn't tell me the details and he is kinda angry when he told us. (He is always like that, he wants to intimidate his students. Idk what's his problem but I don't really mind. I just want to learn). Please give me some advice because I cannot make up my mind. So far these are my thoughts: 1) After clicking delete, the system will tell the user that there are associated records and it will be deleted along if he continues. He will be then ask if he will continue. 2) After clicking delete, the system will tell the user that there are associated records and he can be redirected to a page or there is a pop-up that will show all the associated records and he can manually delete. 3) Don't allow the user to delete. Please advice....


How do I test my non-Ruby website using Ruby?

I would like to build some Ruby tests to test my non-Ruby website. I love the Ruby testing tools (webrat, capybara, etc.) but they seem to be targeted to testing local sites. How can I use these great tools to test external websites? Is there a way to override their settings so that they don't hit `http://localhost` for everything? Or do they work deeper and what I'm asking is impossible? MichaelT, I guess a better way to ask my question is: How do I continuously test a non-Ruby website (say, a .Net one) with Ruby tools? I want to crawl my website every 5 minutes, doing things like logging in, making sure the home page loads, adding things to my shopping cart, and checking out. If any of these steps fails or takes too long then I want the system to notify me in some way so that I can fix it. UPDATE: JustinC has the right idea, apparently this is a duplicate question and I wasn't able to find the correct question to ask. I think either of the solutions in your response will work and I'll play with them both. Thanx! NOTE: I know there are several SaaS providers on the web that do transaction testing but in a quick survey I was unable to find one that A) worked with non-Windows systems, and B) was able to be scripted without some sort of "recording" system (which didn't work on my system).


Balance Tree with depth n has how many nodes maximum?

I couldn't find the answer anywhere, but let's say we have a B-Tree with min = 1 and max = 2: What is the formula to calculate the maximum number of nodes in this B-Tree if the depth is say 100? This question was given on an in-class test to which most everyone had no idea what the answer was. I was completely stumped and am wondering if anyone knows what it is. Thanks a lot!


"flexible" functions in SQL Server 2012?

I'm looking for a very exotic thing and have no idea if it exists at all in SQL Server 2012. (Please forgive me - my background is in T-SQL, but not yet the fine details of SQL 'programming'.) So, whether this 'this' is a UDF or SP or something else - I don't know. The challenge is to have something so flexible that it could return a table with one or more records and a list of fields that is determined at runtime. I guess something like a virtual table, but 'lighter' and faster. Is that doable (and how)? As an example, let's say I have two records (IDs being `1` and `2`) and their values for field '`name`' are '`R1`' and '`R2`'. Some other logic makes me want to combine these into a record with ID '`virtual1`' and two fields names , '`F1`' and '`F2`' with value '`R1`' and '`R2`' - very much boiled down, but this what I'd like to achieve....


What are the key points of Code Complete?

I have heard a lot of people mention Code Complete as a book worthwhile reading. Unfortunately, I am so busy that I don't have time to read it, so can anyone tell me what the key points of the book are?


What are the criteria for evaluating an ORM for.NET?

I'm looking at evaluating ORMs. I've used SubSonic, Linq-to-SQL and Entity Framework. I've got a team of developers ranging from juniors to seniors. What are the criterias for evaluating an ORM for.NET?


Forking SQLite source

I am interested in modifying the SQLite source code and making it available as an experimental public fork (GitHub, Google Code, etc.) However, the SQLite source code is currently in the public domain. If I fork, am I allowed to relicense using GNU GPL 3+? I would like my changes to the original source to be licensed under GNU GPL 3+. Using this Q as an example, I plan to commit the last official source to a git repo and make a note in README about the original source code. I assume this will satisfy this clause: `The work must carry prominent notices stating that you modified it, and giving a relevant date.`


Why can data sent from the server be in a variety of formats, but sent to the server it can only be a string

I recently ran into an error, I guess caused by my lack of understanding of how HTTP works, where I was sending a JSON object to the server to be stored in session data, and then sent back to the client at a later time. When I was sending the data to the server all of my booleans were enclosed in quotes and so when they were later sent back to the client and parsed, all of my false values were evaluated as true - obviously quite a nooby error but it took me ages to debug because I was being stupid and seeing the "false" values in chrome dev tools and thought everything was fine with the response from the server and was looking for the problem elsewhere. So I was wondering, is there a way to set a content-type header when sending data to the server, that would cause data types to be maintained, as you can when sending a response from the server to the client?


Building proprietary software over haskell compiler

Is it perfectly legal to use GHC as base and build some commercial application over its top ? Are there such examples I can can interact with ?


Copyright/General Law for Publishing Online Software

I'm planning on releasing a program I made, but I'm not sure exactly how to ensure people don't just steal it. The price point is $1, but I'm not selling it through an "app store" or anything so I have to handle the legal stuff myself as well as building a website. How do I make it illegal (is it by default?) for people to resell copies of it. What about adding Copyrights to the code itself? Often, when I'm buying software, or even when it's free, I have to accept terms and conditions (which I obviously read _sarcasm_ ). Do I need something like that? I don't know if any other information is relevant, but just in case:   * It's written in Java   * There aren't any similar programs (in design) that I know of like it.   * I'm planing on using Paypal for the payment, though I may look into amazon or see the cost of an ssl certificate with my host to see if it makes sense to do it myself.


What is a NPR Syntax?

what is a NPR syntax, from what i have gathered from internet, i have come to conclusion that NPR is a performance related database. Its based on NPR database Given that what i have gathered is correct, how do i extract data from this Database, what language\Tools should i be using?


Advanced Java Articles

Recently, I've _really_ been getting into programming. I've always loved it, but now it's all I think about. 24 hours a day, 7 days a week. And now that I'm working a lot and about to graduate and get a full time job, I'm looking to sharpen those skills. Lately, all of my programming has been in Java and Javascript. I've nearly mastered the quirks of Javascript, but I'm still "new" to Java. I've written a lot of code, but I don't know the ins and outs. (For instance, I just discovered the try with resources statement.) TL;DR - I'm looking for some articles to hone my Java skills and really know the ins and outs of the language. Anything from refactoring tips to advanced security guides to performance optimizations. Where can I go to become a better Java programmer. (Besides my IDE. I spend enough time there. :p )


Typical instantiation of new object - is there a way to avoid repetitious syntax?

When learning C# (and OO concepts more generally at the same time) something I found very distracting is exemplified by the following line:               ExampleClass exampleObject = new ExampleClass();      It's the apparent redundant repetition that bothered me. Some light dawned when I grasped the difference between declaring a variable and assigning it a value or reference (and that these processes can be separate). However, the above usage is extremely common. Obviously, I've learnt to live with it (and am not expecting the C# syntax to change!) but I wondered if there is a better way. Would there be any merit in the following:               exampleObject = new ExampleClass();      Where the variable `exampleObject` is strongly typed as `ExampleClass` when it is not specified? **EDIT**   [after commenters pointed out ambiguity of above between a declaration of a new, and an assignment, of an existing, variable:] An alternative hypothetical shortened syntax, which avoids the declaration/assignment ambiguity, is:               ExampleClass exampleObject = new();      ...where this would create a new instance of `ExampleClass`, the type having been specified in the declaration of its referencing variable, `exampleObject`. .. but I'm sure this opens up other problems I haven't thought of!   **/EDIT** Obviously, if for some reason we wanted `exampleObject`to be of type `Object`, or - a more common requirement - to be of the type of a parent class of `ExampleClass`, we would specify these types in front of the variable name in the standard way, but is there any drawback to my suggested shorthand in this very common scenario?


Models, controllers, and code reuse

I have a blog where users can post comments. When creating a comment, various things happen:   * creating the comment object, associations, persisting   * sending notification emails to post's author given his preferences   * sending notification to moderators given their preferences   * updating a fulltext database for search   * ... I could put all this in the controller, but what if I want to reuse this code ? e.g. I would like to provide an API for posting comments. I could also put this in the model, but I wonder if I won't lose flexibility by doing so. And would it be acceptable to do all of this from the model layer ? What would you do ?


Where to go after Adobe Flex?

After this post http://blogs.adobe.com/flex/2011/11/your-questions-about- flex.html and especially this paragraph: > ... Does Adobe recommend we use Flex or HTML5 for our enterprise application > development? > > In the long-term, we believe HTML5 will be the best technology for > enterprise application development. We also know that, currently, Flex has > clear benefits for large-scale client projects typically associated with > desktop application profiles. ... Make no mistake, the days of Flex are over. Thus a lot of people are asking themselves: **Which technology(ies) will solve their and their customers problems in a future without flex?** P.S.: Obviously the correct answer for adobe would have been " ...Since we believe, that HTML5 will be the best technology enterprise application development, we will ensure that it will be targeted by future releases of the Flex framework ..."


I want to publish an android app, but I'm afraid of software patents

I wrote an application that helps you to save energy. Actually it is very simple. I check the current location of the phone and I make some changes to the configuration like "sound off, dark display, wifi off...", depending on the location of the user. Sony just released a new phone including one of my apps features (actually they have an extra entry in the options menue for this). I have no idea whether there is a patent for this function. Can I even release this app without risking to be sued some day? I'm very confused about the whole "patent" situation.   I'm about 20 years old and I can't even write a simple app, without investing lots of money for a lawyer. Edit: **I don't ask for legal advice**. I wanted to receive an overview about how developers see or handle the whole situation.


What are some tips for avoiding 'Death by PowerPoint' during a technical presentation?

What are some tips for keeping users interested in a technical presentation?


Detail of acceptance criteria in user story

I have the following example for a user story with acceptance criteria. I would like to know if I am allowed to describe how the GUI must be changed to support the new feature. How much detail can acceptance criteria have? This is my example: **User Story:** As forum administrator I will connect persons in groups, so that people can get organized. **Acceptance Criteria:**   1. The creation of a person group happens below a person group pool (person group pool is an object also visually available in the current software system)   2. The creation happens with a context menu of the persongroup pool. Below the pool one can create new groups.   3. A person group contains: person group-ID, description, remark May that be relevant an right acceptance criteria? Because I describe how you can create a new group by opening a context menu.


How to use Anorm correctly

So I'm new in scala-play world. And just got a look at Anorm and it seemed quite cool. But I was wondering what is the proper way to use it? I guess we shouldn't just put pseudo-SQL everywhere in our code.. I took a look at the website and there is a tutorial explaining some stuff, but it is not said how to actually effectively use it. Can anyone please share their 5cents?


What is the difference of the add and offer methods of Java's PriorityQueue?

In java.util.PriorityQueue we have the methods `add(E e)` and `offer(E e)`. Both methods are documented as: > Inserts the specified element into this priority queue. What are the differences between these two methods?


Are physically handicapped programmers at risk of being discriminated?

This thought hit me the other day: How would an employer look at a one-handed programmer being interviewed? I wouldn't be surprised if the person behind the desk were thinking: > Hm, he/she only has one hand. One hand is half of two hands, hence he/she > can type half as fast as a two-hander. Programmers type code, thus he/she > will produce half as much code. To wit, a one-hander is half as productive > as a two-handed coder. But good programmers do so much more than write code: they device algorithms and solutions to nitty problems; they do code-reviews and upkeep a high standard; they detect and fix bugs; and so much more. Most importantly, they think! If you want typing power, hire an orangutang! But maybe I'm barking at a non-existant problem. Maybe employers don't think a physical disability affects their programming skills. How would I know - I've never met a physically handicapped programmer, let alone a one-handed one, to confirm it. What's your experience? Have you, for example, witnessed a physically disabled programmer not be hired because it was thought he or she wouldn't be able to do the job because of the handicap?


Can PhoneGap and RoboVm work in harmony?

The Goal is to make an iOS app using phonegap and java. When writing phonegap plugins that interact with native code (objective-c) would it be possible instead to make it interact with java when using robovm?


Listing editors and IDE's in your resume?

> **Possible Duplicate:**   >  Hiring developers - listing IDE as a requirement? I've seen this from time to time, that people tend to mention editors in their resume/CV and I've been guilty of doing the same thing(although with IDE's). Is this in any way interesting for the employer, or is it maybe even regarded as something naive and negative? EDIT: I found this question which mentions a few reasons why maybe listing IDE's would be reasonable. Maybe this question should be closed.


How seriously should a programmer take a 'star performer' award?

I work at a medium sized software corp. in India (abt 6,500 employees). This company has a star performer policy; basically they select a person from each "grade" every quarter and give her the award(some gift vouchers and a trophy). Well, not that I am jealous ... but a colleague just got the award and I sort of feel left out. I cant seem to get over the fact that I didn't get it. Do these awards actually provide any benefit to a Programmers career? Do other programmers think more highly of programmers who have won these awards?


Text conversion - Javascript before saving to db, or php when retrieving?

Long story short, I have a social networking site I wrote a while back as a "proof of concept" to myself that I had the skills to do it. I decided to revisit it, and "improve" a lot of the bad coding practices I had when I first wrote the thing (3 years ago). # My current situation Users can create posts. When posting, some bbcode-style tags are allowed, as well as lots of smileys and such. Currently, I take the post, and store it in a mySQL database just the way it was written. When retrieving the post, I use php & regex expressions to convert these tags and smileys in to the appropriate html. For example, I might convert `:)` in to `<img src='/images/smiley.gif' />`. It works well... but then I got to thinking (probably a bad idea). # My proposed solution I got to thinking that doing this conversion every single time the post is retrieved from the database is probably not optimal, as there is an amount of server side CPU usage to perform the all the regex substitutions. The approach I think I would like to take is doing the conversion ahead of time, and storing the html version of the post in the database. This way, when I retrieve it the next 100 times or more, I don't need to keep doing the conversion. I plan on storing both the original text (to be used for editing the post) as well as the converted text (for displaying the post). Other than taking up more space in the database (I'm now storing a raw text version as well as an HTML version, is there any downside to the approach I'm thinking of using? Or does this sound like a reasonable optimization of the whole process? # Update So... after reading the comments from you guys, it sounds like there's probably not a lot of reason (okay, no reason) to try and do this client side rather than server side as I'm doing it now. Why did I come up with such a crazy idea in the first place? Well... right now, I store bbcode-ish text in the database, and when creating the page, run a function replacing all that code with html. What I **want** to do is show a preview box, similar to the StackExchange site, so that when the users are entering their posts, they can see what the formatted result would be. I assume that I need to do this via Javascript, so I've basically duplicated the preg_replace I use in php with replace functions in Javascript, so I can show the preview as the user enters their text. Soooo... I'm now duplicating the text replacement code, once in php, once in js. I figured maybe I should find a way to not have to write the code twice... but after some thought, maybe it's a small trade off to handle it this way. I just wanted to share what's rolling around in my head to put my on this path in the first place...


How do I find someone to build an app for me?

I have an idea that I would like to develop as an app. I have no programming skills though. -Can someone point to some resources on how I can hire a reputable company to do the job for me.   * What are important factors I should consider when choosing?   * Any warning signs or red flags that I should be aware of when choosing?   * Can anyone provide cost estimates? I do not have a large amount of capital to invest. Are there companies that would build and come in for a percentage of the app if they feel it would be successful? Thank you all for your time.


Is it easy for a developer to become a system/business analysts?

I've been developing for a while now and I'm a little bit bored of the tiny details of software development. I would like to be less technical and more focused on the bigger picture, like take more of a system wide approach from a business perspective. Therefore, I'm thinking I might become a business analysts. But so far, I can't seem to determine what a business analyst does that a developer can't do. I know they're supposed to know more about the business rules and how a user uses the system but as a developer, I feel you have to know that anyway. I mean, I've trained new BAs up when they've first started on how the system is used. I'm also good with people, and can write pretty well. So I'm happy to do that, but surely there's much more to the job right? It's just weird because BAs in my area seem to get paid a lot more than developers - what are the skill sets I'm missing as a developer that I need as a BA?


How do you cope with Java coming from javascript?

I learned some javascript as my introduction into programming, and now I'm trying to move on to Java and Python and from there to c++, c#, etc. I've been caught up with schoolwork, so I've had very little chance to learn anything yet, but I have been lurking around SO looking for easy Java questions that I might have asked myself and trying to learn from the answers. I saw one that was kind of interesting. It was a homework assignment about finding the most efficient order of jobs to do, assuming each job took two days and had to be in sequential order. I could have easily done this in javascript, but I'm having trouble figuring out how in Java. With javascript I would just return a two dimensional array. Each element being an array containing the profit and the days to work. Ignoring whether or not that's a stupid way to return data in javascript, what is the proper way to return data like this in Java? In other words, the javascript array I would return would look something like: [ ['1-3-5', 50], ['2-5-8', 90], ['2-4-7', 75] ] In Java, I would have to convert the integers to strings to start off, and then find a way to concatenate two two dimensional arrays... Needless to say, this is the wrong way to go about it.


Managing Multiple Projects that Share Code + Customization

I recently became lead developer of a project at my first non-internship programming position. I've been there for 8 months since I've graduated in December. The project is a web service we offer that is used to track inventory, provide reporting features, and other administration services. The project was originally created for a single client, but has started to become a general project that can be customized for each client. So as each new client signs on, we copy the code from the most recent project and start fresh again customizing the site for the new client. The Customization can be fairly dramatic in some areas of the site, or in some cases very little customization is needed. The problem I see is when we make improvements to the core functionality of the site, that all clients would benefit from, we would have to copy this new feature into every client's site. This seems very cumbersome to me, even with my limited amount of experience and feel there has to be a better way. And to be honest, it usually isn't copied over at all. Same for bug fixes. They'll go client by client, fixing the same bugs as they go in each site. Right now we use Microsoft's Team Foundation Server as our code repository, so a new project for each client is created and added. It may help to mention that it is a smaller company with about 40 employees. Of which 9 are programmer's. I feel like this could be a chance to prove my worth and figure out a better solution. If anyone here has had experience with a similar situation any input would be appreciated. **Update:**   Some questions that have been asked that I have added in here. Q. Describe what the application looks like. Is this a web application? Does the application on it's own look to have three (or more) tiers? Is the code a mess?      A. Yeah this is a web application that has a fairly extensive database, and is FDA regulated. It is used by Pharmaceutical companies to track pharmaceutical drug samples distributed by their representatives. The code isn't horrible, but it can definitely be improved. Which is something I have been trying to do. It was developed with ASP.Net and C#. Q. Tell me about the database. Is there a common database that all instances of the application interact with?      A. No shared database, each client has their own database instance. When a new client signs on we take a copy of the most recent client's database to be used. The database is written in a fairly generic way. Some business logic needs to be tweaked depending on the client, but it usually isn't too extensive and doesn't require modifying table structures or anything like that. And finally, most of the customization that has to be done involves business logic. We don't really change the UI per client or anything like that. Just acquire a copy of the Company's logo and smack it the default spot. Some of the more extensive changes had to do with the companies structure and involved the database/ BL. Most of the time though it is more minor changes.


Is it fair to call a database or a document a "Model", as in Model/View/Controller?

Part of my job is working on line-of-business applications built around client-side databases, such as Access or FoxPro. Other times these local LOBA's have direct document access, such as an exact one-to-one mapping between a logical object an an XML node or references to bookmarks in Word Documents or ranges Excel spreadsheets. While the code is about as messy as one would expect, it's usually fairly stable and the platforms these applications are built upon all have one thing in common: they translate program data to physical storage directly and transparently, from the programmer's point of view. Would it be fair to refer to the database or document in one of these LOBA's as a "Model", when referring to the Model/View/Controller separation of concerns? Or would it be improper to call separation of UI and business-logic MVC unless we make intermediate objects that in turn map to either the UI or the database?


Is over-engineering a warning sign?

So we present a straightforward coding exercise to new candidates with some well defined requirements. Occasionally we receive solutions which don't really solve the problem at hand, but are over-engineered to solve a perceived problem - often outside the bounds of the exercise. Now my question is, is this a warning sign? EDIT: Quite a lot of the discussion is based on the test being flawed - which is a fair point. As I described in a comment, the basic premise of the test is to show how you can read the data from the file in a sensible way (and you'd be amazed at the variety of approaches we see), and how to match the items before calculating the latency between the updates. Now for this to work, certain assumptions have to be made about the data, and we look for these assumptions, and we also state explicitly that we want to see the approach you take (including OO approach etc.) All this in a two hour time frame. IMHO, when I was interviewing it was the most complete exercise I came across. The particular scenario which I'm pondering about is where a candidate, rather than reading from the file, accepted "network" input in a multi-threaded application, which clearly is not in scope.


How should I architect multi-language support for a group of applications?

I have about 8 web applications (all of them ASP.NET based), and I want to implement multiple language support for all of them and have an architecture that I can leverage on new web applications down the road. I would also like to try to centralize the admin piece (where all the text translations and other language specific resources reside), do you know of any tool or architectural pattern that might be useful in this case? The only robust solution I can think of is to have a web application that manages the language support resources and all the other web applications connect to this centralized app/service, but I'm afraid that this solution will have a performance impact on all applications if not implemented the right way. I would greatly appreciate any suggestions.


GPL License - Selling and Stealing

I understand that when any software under the GPL is given to another the recipient has the same rights over the software that I do. I also understand that this applies to "a work based on the Program". Questions: 1) I noticed several companies sell wordpress plugins and require that you buy a new plugin for each website. Plugins are obviously "a work based on the Program". How do they do this with GPL? (ie I want to do this and not have someone take my plugin, turn around and sell it for themselves. I'm working with Drupal, however, not Wordpress). 2) If I write a module for in-house purposes and an employee takes that module home and puts it online, is that legal? What I mean is that if someone steals my code do they still have the same rights over the code that I do? 3) If I use Drupal modules in a software-as-a-service business and let people use it (ie hosted on my servers), do I still have to give them the source? References: http://www.gnu.org/licenses/quick-guide-gplv3.html


Is it better to use assert or IllegalArgumentException for required method parameters?

In Java, which is more highly recommended, and why? Both types will throw exceptions, so in that regard handling them is the same. `assert` is slightly shorter, but I'm not sure how much that matters.               public void doStuff(Object obj) {         assert obj != null;         ...     }      vs               public void doStuff(Object obj) {         if (obj == null) {             throw new IllegalArgumentException("object was null");         }         ...     }


How to conduct a 3 days training on current techniques like TDD and CI

I am tasked to conduct a training for an upcoming team of 20 Java developers for a new project. The project owner wants us to use state of the art development techniques like TDD and CI. The developers are skilled Java developers but have minor to no experience with unit testing, and most likely only superficial experience in refactoring. So the overall project manager scheduled a 3 day training for all developers, and some project managers, to learn the "new" techniques, get everybody in a shared mindset and get started. So I have 3 days (aka 20 hours) to teach them   * ~~Software Craftsmanship~~ deleted due to answer   * Unit Testing   * TDD/BDD   * Refactoring   * Static Code Analysis   * CI Obviously I can't teach them everything. So my questions is   * **how to distribute the available time on these (and other) topics** ,    * what to focus on and what do omit,    * and how to best **conduct a training session based on these topics**?


How to make big chunk of hardcoded menuitems in a programmable way

So in the javascript app, we have a lot of repeated chunk of `menu items` with the specific `settings`: URL, Name, Title, etc etc (these settings sometimes can be optional). Here is the gist of the menuItem and we have tons of them. The client pushes new changes every month or twice per month on these items, either the menu item should be named differently or the url is outdated or whatever. Instead of going and changing each URL everytime, I thought about:   * Creating a web-service, with a complete CRUD on menuitems, whatever comes in there, goes dirrectly via JSON, to the app Well, I would like to hear if you have some thoughts on this idea of `configuring` the application rather than hardcoding the app each time when the CR comes. Here is the gist of the menuItem and we have tons of them. All help will be appreciated


Good public API for use in demos and documentation?

I have created a utility library and open sourced it on Github, and I'd like to document the HTTP utilities. I created this around some apps I've developed, but none of the APIs I use are for public consumption. I want to use a well known public API in my documentation so that code samples will work and be really easy to understand for the user, but I don't work with any such API so I'm not familiar with any...looking for suggestions.


How to stop gold-plating and just be content to release working developments

The development team that I'm a member of has recently adapted to work according to Agile practices. This has personally highlighted the fact that I can't stop myself gold-plating code (and documentation) and I consequently exceed original estimates, when I could've delivered solutions that meet the requirements much earlier. I think my ethic is bordering on the obsessive in that I become too attached to my code and am rarely content to release before I've refactored and perfected it to the nth degree. I am happy that I have realised this but how can I change my attitude/mentality to be content with my progress and release on-time instead?


Which of these OOP examples demonstrate proper OOP concepts?

I'm still trying to wrap my head around OOP. All of the following examples work, of course, but is there one (or possibly another) that best exemplifies OOP concepts?               /**      * For the following examples the Image class queries an image      * and associated info from a database, which is passed on      * instantiation via dependency injection.      */          $image = new Image(new Db());      **Example 1:**               if ($image->setImageId($id, $size)) {         header('content-type: ' . $image->content_type);         header('content-length: ' . $image->length);         echo $image->getBytes();     }      **Example 2:**               if ($image_info = $image->getImageInfoByIdAndSize($id, $size)) {         header('content-type: ' . $image_info->content_type);         header('content-length: ' . $image_info->length);         echo $image->getImageBytesByIdAndSize($id, $size);     }      **Example 3:**               $image->setImageIdAndSize($id, $size);          if ($image_info = $image->getImageInfo()) {         header('content-type: ' . $image_info->content_type);         header('content-length: ' . $image_info->length);         echo $image->getImageBytes();     }


I'm going to quit my job because of our platform: how can I leave a productive explanation of this?

I'm planning on leaving my current job because we're locked into using Blub, with an enterprise Blub framework and a Blub-level web server, on mediocre shared hosting. My coworkers are friendly and my boss is an average small business owner - I want to leave entirely because of the technical reasons. I feel like being soaked in Blub is bad for my brain and making me a worse programmer. When I leave, how can I explain this to my boss and coworkers? How can I phrase my complaints about Blub productively? What kind of warning can I and should I leave for my successor in documentation? _(trying to make sure I meet thestandards)_


Interested in a million things, have a million goals: how to choose what to focus on

I am currently working as a Web Application developer using .NET Technologies. I am interested in learning more about the technologies that I work with, but I am ALSO interested in a million other things... (including Systems programming, Networking, Game Development, Mobile Development, Computer Science topics, Math, participating in an Open Source project, starting my own business, etc). I can't seem to focus on one thing to become an 'expert' in when there are so many **other** things to 'master' that are pulling at my attention, and there are only so many hours in the day... My question is, what are some good strategies to stop procrastinating and manage time effectively, so that you can get the most out of your free time and learn what you are interested in, while not losing sight of other priorities and letting other interests fall through the cracks? Or do I have to sacrifice, and if so, how do I prioritize what to sacrifice? I'd love to hear what you guys have to say... Thanks


How to model/structure data that contains parent/child relationships for the same entity?

I think it is just my thinking that is off here. Suppose I have two entities: question and choice. A question can be a parent or child, or both (in relation to other questions). It seems that this model is too simple and is an unresolved many-to-many, but I think my thinking is the problem here so this is more of a conceptual question. What is the best way to design/model this? Please explain why it is or isn't a many-to-many relationship, and whether or not it needs to be resolved and why. See below: ![idea](http://i.stack.imgur.com/7kUG9.png) A question can be a parent or a child, or both (potentially multiple times). Programming logic would prevent the child from being its own parent and vice versa. It seems I'm missing a linking solution of some sort here, or I'm just not wrapping my brain around this.


How to know if an Open Source project is mature enough to use in a product?

There are some open source projects that I'd like to incorporate into a product at work. We don't have the bandwidth nor the subject matter expertise to do it ourselves. I found these by searching in Google. I'm unaware of any "major players" that utilize the projects, but I'm pretty encouraged by what I see. Now, I'm a bit concerned about the amount of risk I'm exposed to by using joe- blow's open source project. If it takes me 95% of the way there, perhaps the remaining 5% is easy to add or fix. Perhaps it's non-trivial. **How do people go about determining whether an open source project is mature enough to use in a product?** This is not a hobby project, so stability, maintainability, etc. are paramount.


Should we enforce code style in our large codebase?

By "code style" I mean 2 things:   1. Style, eg.              // bad     if(foo){ ... }          // good     if (foo) { ... }        2. Conventions and idiomaticity, where two ways of writing the same thing are functionally equivalent, but one is more idiomatic. eg.              // bad     if (fooLib.equals(a, b)) { ... }          // good     if (a == b) { ... }      I think it makes sense to use an auto-formatter to enforce #1 automatically. So my question is specifically about #2. I like to break things down into pros and cons, here's what I've come up with so far: **Pros:**   * Used by many large codebases (eg. Google, jQuery)   * Helps make it a bit easier to work on new areas of the codebase   * Helps make code more portable (this is not necessarily true)   * Code style is automatic once you get used to it   * Makes it easier to fast-decline pull requests **Cons:**   * Takes engineers’ and code reviewers’ time away from more important things (like developing features)   * Code should ideally be rewritten every 2-3 years anyway, so it’s more important to focus on getting the architecture right, and achieving high test coverage   * Adds strain to code reviews (eg. “don’t do it this way, I like this other way better”)   * Even if I’ve been using a code style for a while, I still sometime have to pause and think about how to write a line better   * Having an enforced, uniform code style makes it hard to experiment with potentially better styles   * Maintaining a style guide takes a lot of incremental effort   * Engineers rarely read through the style guide. More often, it's cited in code reviews And as a secondary question: we also have many smaller repositories - should the same code style be enforced there?


Languages implemented in Python?

AFAIK, Scala and Clojure are implemented in Java and Java is implemented in C. I suppose that many or most languages are implemented in C, for instance Perl, Python and SQL. I don't know much about language implementation but maybe you can tell me the rationale to favor one implementation language Java over another C? Are there any theories about one language implementing another, or are we resorted to Turing machine theory where a language is regarded are a Turing machine?


Utility Classes in MVC - ASP.NET

So I was wondering today, where would you put utility classes in an ASP.NET MVC app? By utility classes I mean classes that can be static and are just used to perform a function. Like a class to send an email that takes email address , subject, and body as arguments.   I would assume maybe creating a separate folder and namespace would be good enough, but wanted to get everyone opinions


What is the pattern called when getters take responsibility for the setting?

I've been heavily using a pattern for years now, but I don't know what it's called. It looks like this....               class xzy     {            public function getFoo()       {         if ( undefined(this.foo) )         {            this.foo = new Foo;         }         return this.foo       }            public function setFoo(foo)       {         this.foo = foo;         return this;       }            public function getResult()       {         if ( undefined(this.result) )         {            this.result = this.getFoo().action();         }         return this.result;       }          }      It find it great for testing yet still allows for a high level of encapsulation. It's also great for drying up code. I also very rarely use a constructor. I'm now in a position where I could really do with specifying the pattern in some documentation but I don't know what it's called and it's a hard thing to try and Google.


Who does the UX on a scrum project?

OK. Let's say you're working on a textbook scrum project. You've got a scrum master collaborating with a product owner. The next sprint is UI-heavy - by the time your coders start building screens, you really want to have _some_ idea what they're going to look like. Who does the wireframing, and when? The product owner? Somebody supporting the product owner? The scrum master? If you have a UX expert, do they work alongside the coders _after_ the sprint has started, or do they supply wireframes & mock-ups up-front that sit alongside your story cards and constraints to guide and inform the work the developers are doing? I'm pretty sure we need some UX help, you see, but I'm really not sure where to apply it... EDIT: Let me rephrase the question. How do you deliver consistent, high-quality user experience on an agile project?


Keep my classes and methods as small as possible?

A few days ago, I was talking to a Software Engineering PhD candidate and at some point she said to me: > Keep your classes and methods as small as possible And I wonder if this is always a good practice. I mean for example, is it worthy to have a class with only 2 attibutes in it? For instance, In some methods I need pairs of integers to work with. Should i write a "PairOfIntgers" class? Could this way of thinking "break" the code in too many pieces?


Best practices for web application Authentication/Security (Any Platform)

I got a question today from my manager asking me my thoughts on what is considered an acceptable design for authentication of a web form application, especially in regards to the nature of many popular browsers to "Remember Password" for your typical user name password login fields. I am having trouble coming up with an answer that I feel is acceptable. In light of Sony's embarassing security flaws, I really want to be careful, even though the data being stored on people is of a lower sensitivity. We are not storing social security numbers or even addresses however we are storing phone numbers, email addresses and a photo of a visitor. He is concerned that a user can simply Remember Password on a public terminal, then someone can simply jump on this terminal and begin viewing or modifiy data in an unauthorized way. I am fairly certain however that at least on Windows workstations that the browser will not "Remember Password" across Windows user accounts. Beyond this I am implementing a one way password encryption at the server side (store encryped password in the database, encrypt user supplied password on the server, compare to encrypted string from database). There are no immediate plans to incorporate SSL encryption however this is still an option. Are there are any major security flaws with this approach? Do you have any better suggestions?


Understanding unit testing concept

I've just started writing unit tests and I'm not sure am I doing it the "right way." Should I test every class "by removing dependencies"? In other words, does unit testing mean: "test part of a code with assumption that provided dependencies to other modules are correct and test these dependencies as single modules later in other unit test classes"? For example, I write WinRT application in Model-View-ViewModel manner and I have MainViewModel class. This class has dependency to `IDataRepository` which is injected in constructor. `MainViewModel` is responsible for handling commands and connecting model with view. `MainViewModel` has commands like `CopyItems`, `LoadData` etc which are relying on `IDataRepository` implementation. Should I pass fake (mock/fake it??) `IDataRepository` in `MainViewModel_Tests` and test just is data loaded, copied etc. on command execution? Should one test check just things what class really do - not what dependencies do?


Is it ok if I don't know C but I am good with C++?

I have a question which I think can be best answered here. I am pretty good with `C++`, good as in I am comfortable with the language, I have read `Accelerated C++` and done almost all the exercises. However, I have a big problem. Do I need to learn `C`? I have never done `C` ever in my life. I just started with `C++` when I started with programming. Probably cause I was always interested in knowing why everyone calls the language so complex. Now though I know the answer to that question ;) I am particularly interested in knowing whether I can survive without knowing `C` in today's world. Like if I give an interview in a company, if I tell them that I don't know `C` \- will they take it as OK? The two languages I am good with is Python and C++. I am asking this cause I have heard that companies ask data structures in interviews. So if they ask me to implement it, and if I do it in C++, is it acceptable? And people who say 'how can you not know C when you C++', please don't reply :) No offense, but I fail to understand why learning C is prerequisite.


Can I release complementary Windows 8 and WP8 apps on their respective stores?

I am creating a pair of apps, one to run preferably on tablets, but also laptops and PCs, and the other for WP8. These apps are complementary - having one is of no use without the other. I know there is a Windows Store, and a Windows Phone store, so one would be released on one, and one on the other. My question is: as these apps are useless by themselves (although in most cases it won't be the same people running both apps), will there be a problem with offering these useless-when-used-alone apps? IOW: Person A will use the Windows 8 app to interact with some people that have the WP8 app installed; those with the WP8 app will interact with a person or people who have the Windows 8 app installed. What I'm worried about is if these apps go through a certification process where they must be useful "standalone" - is that the case?


Script files as resource or solution project?

I've written a program for another group within my company that uses scripts. These scripts are user selected by the use of two drop down lists: category and name. Currently the application uses an XML file that is on a network share to populate the drop down lists with the scripts and their associated categories and titles. The XML file also contains the network path location where the scripts are housed as well as title, description and usage details. I am trying to decide on the better way to manage access to the scripts without allowing the end users to be able to edit them with a text editor. I've been going between adding them as a project within the solution or adding them as references. Does anyone have any thought on either of those options or possibly a better solution? EDIT: I think I may have figured out a solution for what I'm looking to do. http://support.microsoft.com/kb/319292. I'll load the macros as well as the XML file and that should allow me to accomplish what I'm trying to do.


What exactly is my program "linking" with overall?

I have heard that my C++ programs "need to link with the C++ library/runtime". However, the C++ runtime is just the compiler inserting stack operation code in to the image, or "boilerplate" code if you will. The C++ runtime is basically intrinsic to the program itself, so "linking the runtime" is a bit illogical. Linking a library makes more sense, especially since the C++ libraries are independent objects which would otherwise need resolvement with the source program itself, and relocation. So I wondered, besides the C++ library, what else, or how do you know what you are linking with exactly? For example, if I'm supposedly linking with the C++ library, I also need to link with the OS-specific library and API as well, or at least a wrapper of some sort that will deal directly with it. So the linker will, in effect, link the main program file with the C++ library with the OS-API/library? That doesn't sound particularly right. Basically, the linker will link multiple libraries together(statically, in this example, at compile/link-time)?


Utilising Promises, Closures and Recursion in Node.js

I have employed a recursive call to a closure in order to mitigate against some race conditions I am getting (That's what I think it is). I'd like to know if (and why) this is a good solution or a bad solution.               function getResources(activity, resource) {         var q = when.defer(),         resourceQuery = constructSelectionQuery(resource),         timeoutCounter = 0,         timeoutLimit = 100;         function queryDatabase() {             query.getResult({                 query: resourceQuery             }, function(err, result) {                 if (result.length === 0) {                     if (timeoutCounter > timeoutLimit) {                         q.reject();                     }                     timeoutCounter++;                          //subsequent call(s)                     queryDatabase();                 } else {                     q.resolve(result);                 }             });         }              //initial call         queryDatabase();              return q.promise;              }      * * * What I am trying to ascertain is the validity of using recursion and closure in this combination - is this an acceptable way of approaching the problem of repeating the call to the database? Without the repeating of the call the result is sometimes empty. This is curious as this function is only called after the record has been saved. However this is in another system so I am assuming the speed of indexing is at fault in MySQL - I don't want to go into that aspect of the system as I'm happy with what I've got - My question is isolated to using this pattern - a recursive call to the closure as a way to repeat the call.


measuring database load

I was reading about memcache and one of the questions that I have for this moment is about 'measuring database load'. In this tutorial they are talking about a 'database load of 20'. How can I measure the database load of a web application?


Patterns for Handling Changing Property Sets in C++

I have a bunch "Property Sets" (which are simple `structs` containing POD members). I'd like to modify these property sets (eg: add a new member) at run time so that the definition of the property sets can be externalized and the code itself can be re-used with multiple versions/types of property sets with minimal/no changes. For example, a property set could look like this:               struct PropSetA     {         bool activeFlag;         int processingCount;         /* snip few other such fields*/     };      But instead of setting its definition in stone at compile time, I'd like to create it _dynamically_ at run time. Something like:               class PropSet propSetA;     propSetA("activeFlag",true);  //overloading the function call operator     propSetA("processingCount",0);       And the code dependent on the property sets (possibly in some other library) will use the data like so:                bool actvFlag = propSet["activeFlag"];      if(actvFlag  == true)      {        //Do Stuff      }      The current implementation behind all of this is as follows:               class PropValue     {      public:         // Variant like class for holding multiple data-types         // overloaded Conversion operator. Eg:         operator bool()         {           return (baseType == BOOLEAN) ? this->ToBoolean() : false;         }         // And a method to create PropValues various base datatypes         static FromBool(bool baseValue);     };          class PropSet     {           public:       // overloaded[] operator for adding properties       void operator()(std::string propName, bool propVal)       {         propMap.insert(std::make_pair(propName, PropVal::FromBool(propVal)));       }           protected:        // the property map        std::map<std::string, PropValue> propMap;     };      This problem at hand is similar to this question on SO and the current approach (described above) is based on this answer. But as noted over at SO this is more of a hack than a proper solution. The fundamental issues that I have with this approach are as follows:   * Extending this for supporting new types will require significant code change. At the bare minimum overloaded operators need to be extended to support the new type.   * Supporting complex properties (eg: `struct` containing `struct`) is tricky.   * Supporting a reference mechanism (needed for an optimization of not duplicating identical property sets) is tricky. This also applies to supporting pointers and multi-dimensional arrays in general. Are there any known patterns for dealing with this scenario? Essentially, I'm looking for the equivalent of the visitor pattern, but for extending `class` properties rather than methods. **Edit:** Modified problem statement for clarity and added some more code from current implementation.


Should I use the new method/action to retrieve records? (Rails)

I have an admin controller that is just used for its index action which renders a view with the most recent updates to certain resources:               class AdminController < ApplicationController              before_action :authenticate_user!         layout "admin"              def index             @events = Event.last(3)             @foos   = Foo.last(3)             @bars   = Bar.last(3)         end          end      Now, I want to create a new event. So I have an Events controller:               class EventsController < ApplicationController            before_action :authenticate_user!, only: [:new,:create]       layout "admin", only: [:new]                 def index         @events = Event.all       end            def show       end            def new       end            def create       end                    end      But I want to display a list of events that have previously been added in the same view as the form for creating a new event. Should I retrieve all the events in the new action? i.e.               def new       @events = Event.all     end      Or is there a better approach(perhaps more restful)?


RFC: Extending the MVC Design Pattern

I've been using the MVC pattern in my applications for years (with full separation of the controller from its views). Having to implement several hundred views to represent a little over 100 model's for a potential contract, this time around I'd like to reduce the development time of my UI tasks and also add a few additional features (view decoration, etc). I'm curious to find out if anyone has used or even implemented a design such as the one I'll explain bellow and if so, what were your pros and cons were. Without getting into too much detail, I'm going to simply elaborate on an example of an API I have been juggling with in my head for a few days along with some explanations a bit later on, so here goes:               Model m = dao.getInstance(ID);  // ie: possibly fetch it from a database          VTextField text = new VTextField();  // simply 'extends' the Swing components          text.setModel(m);          Decorator deco = DecoratorFactory.getInstance();  // specific to a customer          text.setDecorator(deco);          Controller c = ControllerFactory.getInstance(m);          text.setController(c);          Validator v = ValidatorFactory.getInstance(m);  // get the current validator          c.setValidator(v, "validateText");      So in the example above, the idea is that I will have the same application for several clients. Although each have accepted the general usability, each want their branded L&F to it, some based on business rules (ie: a text field has errors, the background of text-field should be in yellow with red fonts... an other want the text in black and the background yellow with a red border). What I was thinking was that on any event (on focus, loss focus, key typed, etc), the component would basically invoke the controller. In turn, the controller (through reflection) would invoke the validator. If validation passes, the controller simply updates the model. If validation fails, the controller does not update the model. The controller would keep a state of all of this (viewing, editing, editing with error, etc) and would delegate to the decorator which would adjust the L&F of each component based on client demands. This would avoid a ton of 'if/else' blocks directly in a single controller. The controller, validator and decorator knows which concrete instance to load based on which client is running the application. This way, I can separate the logic for each client and reuse when it is shared behavior. The decorator doesn't overide the paintXXX() methods, but simply calls the 'setBackground(c)', 'setBorder(b)' and all of these setter methods already available in the Swing components. The reason I extend each component is simply to add the 'setModel(m)' and 'setController(c)' methods along with any framework logic I'll need. When the component is in 'view' mode, it usually doesn't paint the border and background and all that stuff (looks more like a traditional web page). When it is in 'edit' mode then it looks more like a Swing component. When I design application UI's I usually stick to only a few major components (JTextField, JTextArea, JPanel, etc). So it wouldn't be too much work on that side. I have not started to implement any of this stuff just yet, so if you know of existing libraries which does something similar, please point them out. My only real issues I have at this time is how to handle cases where component depend on each other. For example, two text fields having an int value. If one field is odd then the other must also be odd and if one is even, then the other must be even. When the validation occurs, the validator would need the value of the other text field to properly validate... so I still have not ironed out that part.


heading in right direction? C++ and class templates

I'm working on some inherited code in C++ and am trying to use 2 classes with templates as I need 2-types of each class to operate on floating point or integer data (double v uint64_t to be exact). In the two classes that I'm trying to "templatize"(?), one inherits from the other. Data definitions needed for both are defined in the 'more base' class, some with the parameterized typename 'T', and some with resolved types (e.g. 'int') in the 'protected:' section. The corresponding implementation (.cc) file for the more base class compiles 'ok', but the implementation file for the derived class (which is also 'templated') isn't seeing the the class data from the 1st template. I thinking that the derived class file wants to see a resolved version of the more base class's template definition, but am not sure. Example: more base class template file (.h) has:               template < typename T > class FieldMeter : public Meter {     ...     protected:         int numfields_;         F *fields_;         F total_, used_, lastused_;     ...     };      'less base' class (.h) file:               template <typename T> class FieldMeterGraph : public FieldMeter <T> {         ...     }      Problem comes in less-base class .cc file when accessing 'numfields_' or 'fields_':               fieldmetergraph.cc:51:24: error: ‘numfields_’ was not declared in this scope       if (!heightfield_  && numfields_>0 && graphNumCols_ >0)      When both were simple classes, I didn't get the above, so it's a case where data being declared in the more base, 'templatized' class isn't accessible in the implementation of a derived template. My terminology may be a bit off -- but it seems like this should be doable -- with "end classes" like "`cpumeter`" that would pass a solid data type (`uint64_t`) to the toplevel `FieldMeterGraph` template. I'm tempted to resort to storing the type at compile time, and doing the resolution manually, at run-time like I would in 'C', but as I understand it, this should be resolvable by the compiler (g++ using C++11), at compile time. I do have Stroustrup's 4th tomb as reference, but it seems his examples are tending toward being a bit too generic for me to correctly derive a resolvable, concrete example that g++ likes (though g++'s error messages do seem to be extraordinarily more helpful and precise compared to what I normally get in perl..).... If someone knows how to more quickly resolve my conundrum, than my randomly trying various things that don't work, it would be appreciated! ;-) Thanks!


App shell using MEF

I am designing an WPF app shell using MEF. I would like to have the app start a "view" upon startup. I also would like the option of having another add-in have a "startup" attribute and then the app would load that one instead. I've made an interface:               [InheritedExport]     public interface IStartupParams     {         /// Gets or sets the WindowMode property.         WindowMode WindowMode { get; set; }              /// Gets or sets the NavigateUri property.         string NavigateUri { get; set; }              /// Gets or sets the Priority property.         int Priority { get; set; }     }      So the app would load multiple IStartupParams concrete classes and select the one with the highest priority. What do you guys thing about this design? Any ideas?


Write tests for unit tests in TDD?

In an answer to another question, I suggested creating a randomized value for input to a specific method. In my experience this has been useful for making tests more readable and it lets you skip the "trivial phase" where you hardcode specific results in a method. Here's the unit test code pasted from the other answer, for quick reference:               [Test]     public void FullHouseReturnsTrue()     {         var roll = AnyFullHouse();              Assert.That(sut.IsFullHouse(roll));     }     [Test]     public void StraightReturnsFalse()     {         var roll = AnyStraight();              Assert.That(sut.IsFullHouse(roll), Is.False);     }      A couple of comments in response suggested that this strategy would not work well, because the helper method would need to be tested also. In my experience, I've never had a need to test methods like this, since creating the corresponding production code also tests my test code. Do `AnyStraight()` and `AnyFullHouse()` need to have their own unit tests? If so, how do you solve the chicken-and-egg problem that presents? **EDIT** Would I still want to create dedicated unit tests for the `AnyFullHouse` algorithm if I inlined the method?               [Test]     public void FullHouseReturnsTrue()     {         var roll = listOfHardCodedFullHouseRolls[_random.Next(0, listOfHardCodedFullHouseRolls.Length)];              Assert.That(sut.IsFullHouse(roll));     }


Single configuration file for multiple WCF services

We have a scenario where we have multiple WCF services hosted on the same server connecting to same database. But currently they all have their separate web.config files. So each time there is some change or new deployment to another server, each and every web.config needs to be changed. Is there a way we can have a single configuration (be it on a file or in memory/db) which can be shared among all the services on any given server? If so what would that be? If not, why not? If we shouldn't go for this approach, why not? Currently we have such a hierarchy (Folder structure)   * Services      * Service1     * Service2 ... ...     * ServiceN


Is there a software engineering principle that relates reuse and regression test cost on a production system?

I've worked on a large financial transaction system for a bank that looked after Pensions and Investments. After 15 years of feature changes, the manual regression test cost had climbed to $200K per release. (10M LOC, $10M transacted per day). This system also interfaces with 19 other systems around the company moving lots of data around. This system was implemented in Java. What we observe however, is that the more 'reuse' we do, the more regression test costs go up. (The reason being that you need to "test the code you touch" - and reused/shared code impacts a multiplicity of places when it is touched. So despite 'DRY - Do Not Repeat Yourself' - ie don't copy and paste code - we observe a financial incentive to copy and paste code. This is to drive regression test costs down, because we don't want to modify code that could be shared, because that will cause a big regression test impact. ) My question is **is there a software engineering principle that describes the relationship between reuse and regression test costs?** The reason I'd ask this question is that arguably there is a cost benefit in decomposing the system into smaller parts to be tested. **Assumptions:**   1. 'Regression test' means 'acceptance test' - ie another group spending time to write new and reuse old tests against the system on behalf of the business, including environment and data setups.    2. I know the knee-jerk reaction to a big regression test cost is 'more automated tests'. This is a good principle. In this environment there are a couple of challenges.  (a) Automated tests are less useful across system boundaries, unless that system has a high automated test coverage as well. (Sphere of influence challenge). (b) It is culturally difficult to get momentum on programmer time or capital investment on high automated test coverage when your system is already large and complex. (c) The cost of maintaining automated tests is hidden on a project, and so they are easily discarded at a project level. (d) This is just the cultural reality of working in a bank. (e) I'm working to solve this problem in a different way (decomposition).


At what point should I have my Windows developers upgrade to the latest release of Windows?

At what point should I begin upgrading our developer's machines to a later Windows release? From experience, Microsoft typically has an epic fail about every other O.S. (I am really not trying to start a debate about this, it is my perception let it be) i.e. 2000 was a stable and useful O.S, yet m.e. didn't do well, xp was a great O.S. that many businesses still use, Vista didn't do well (I know that the reason this one didn't do well wasn't really Microsoft's fault and that Vista and 7 are the same major revision), while 7 seems to be an excellent O.S. that will be around for a while--sort of like xp is now. Anyways, this makes me reluctant to upgrade our development machines to Windows 8.   * a. I don't want to cost our business a ton of money for an O.S. that will only be used for a year or two.   * b. They also have to have linux dual boots, and I have read that Windows 8 and grub will not play well together. I do want our developers to develop in the latest environment and to have a leading edge in any technology they are developing with. I do want to stay ahead of--or at least with--the technology curve, yet I want it to make business sense. So in particular, should I upgrade their machines at this point? In general, what calculus should I use for deciding this sort of thing? **edit** They do write desktop UI applications as well as ASP.NET applications. Also, I do make sure that they always have the latest release of Visual Studio.


Is it a bad idea to ask an interviewer what the greatest strength and weakness of their development team is?

I was wondering if this was a good question to ask a possible employer when interviewing for a developer position: > What is the greatest strength and weakness of your development team? We all get this question when we are in an interview, so why not ask them in return? I think it is a very good question because we could find out about the team, and how this strength or weakness could affect us, but I don't want to annoy the interviewer. Is there any downside to asking this question when interviewing for a developer position?


OpenUp/Basic In Practice

I have some confusion understanding the OpenUp/Basic process. It is described as an iterative process consisting of four phases:   * Inception,   * Elaboration,   * Construction, and   * Transition.  I am not clear if a single iteration consists of all these phases or if we make several iterations within a single phase and then move to next phase. In the later case, it seems to be impractical but in former case feasibility of project can not be identified. Is there anyone who has experience implmenting it in the organisation?


What is the rationale behind semantic web?

Is the semantic web extended form of the relational database that the data should not be redundant? That is it should exist only as an entity and all its characteristics defined by the other entities should be linked via predicates.