Which is the most practical way to add functionality to this piece of code?

I'm writing an open source library which handles hexagonal grids. It mainly revolves around the `HexagonalGrid` and the `Hexagon` class. There is a `HexagonalGridBuilder` class which builds the grid which contains `Hexagon` objects. What I'm trying to achieve is to enable the user to add arbitrary data to each `Hexagon`. The interface looks like this:               public interface Hexagon extends Serializable {              // ... other methods not important in this context              <T> void setSatelliteData(T data);              <T> T getSatelliteData();     }       So far so good. I'm writing another class however named `HexagonalGridCalculator` which adds some fancy pieces of computation to the library like calculating the shortest path between two `Hexagon`s or calculating the line of sight around a `Hexagon`. My problem is that for those I need the user to supply some data for the `Hexagon` objects like the **cost** of passing through a `Hexagon`, or a `boolean` flag indicating whether the object is **transparent/passable** or not. My question is how should I implement this? My first idea was to write an interface like this:               public interface HexagonData {              void setTransparent(boolean isTransparent);              void setPassable(boolean isPassable);              void setPassageCost(int cost);     }      and make the user implement it but then it came to my mind that if I add any other functionality later all code will break for those who are using the old interface. So my next idea is to add annotations like `@PassageCost`, `@IsTransparent` and `@IsPassable` which can be added to fields and when I'm doing the computation I can look for the annotations in the `satelliteData` supplied by the user. This looks flexible enough if I take into account the possibility of later changes but it uses reflection. I have no benchmark of the costs of using annotations so I'm a bit in the dark here. I think that in 90-95% of the cases the efficiency is not important since most users wont't use a grid where this is significant but I can imagine someone trying to create a grid with a size of `5.000.000.000 X 5.000.000.000`. So which path should I start walking on? Or are there some better alternatives? _Note: These ideas are not implemented yet so I did not pay too much attention to good names._


How to design a website with search capabilities?

Suppose you want to create a web page with some search capabilities over a database. Search has to be restricted both on some categorization of data and open text given by the users. Functional and non-functional requirements pose this constraints:   * Search has to be fast   * Data representation paradigm (i.e. Relational, Object-Relational, Semistructured...) should support big modifications on every stage of software lifetime.   * Database's paradigm should permit easy refactoring for existing client code Having this into account   1. Would you recommend a relational database? How would you tackle the constraints in this scenario?   2. Would you recommend a XML database? How would you tackle the constraints in this scenario?   3. If you think above solutions to be not useful in the light of this problem... what could be a useful approach? Please give some bibliography (or some websites) supporting your answers. thanks!


Is PhoneGap scalable?

I'm a front-end developer that is looking into mobile apps development. When I'm searching for ways getting into app development PhoneGap comes as first and most familiar language stack development method. It's really sweet that I can develop an app with HTML/CSS/JavaScript using PhoneGap APIs. But is PhoneGap scalable enough? How far I can go with it in making complex apps and large scale apps? Why and why not I should start learning Objective-C to get into app development?


How can I let prospective employers know I'm a great developer?

I've recently read through Joel's guide to finding great developers, and I feel really strongly that I am _smart_ and _get things done_. The problem is, I didn't learn how to _get things done_ until about halfway through college, so my GPA is less than stellar. Additionally, I've got a few other things going against me: late into the job market (~30), no internship, state college instead of university, and when I graduated, I pretty much had to take the first job that offered. With all of these things piled together, my resume (the first step to getting a job), is not terribly impressive. What can I do to let people know that I'm a great developer and would complement the best companies in the world?


The idea of functionN in Scala / Functionaljava

From brain driven development > It turns out, that every Function you’ll ever define in Scala, will become > an instance of an Implementation which will feature a certain Function > Trait. > > There is a whole bunch of that Function Traits, ranging from Function1 up to > Function22. > > **Since Functions are Objects in Scala and Scala is a statically typed > language, it has to provide an appropriate type for every Function which > comes with a different number of arguments.** If you define a Function with > two arguments, the compiler picks Function2 as the underlying type. Also, from Michael Froh's blog > **You need to make FunctionN classes for each number of parameters that you > want?** Yes, but you define the classes once and then you use them forever, > or ideally they're already defined in a library (e.g. Functional Java > defines classes F, F2, ..., F8, and the Scala standard library defines > classes Function1, ..., Function22) So we have a list of function traits (Scala), and a list of interfaces (Functional-java) to enable us to have first class funtions. I am trying to understand exactly why this is the case. I know, in Java for example, when I write a method say,               public int add(int a, int b){         return a + b;     }      That I cannot go ahead and write               add(3,4,5);      ( error would be something like : method add cannot be applied to give types ) We simply have to define an interface/trait for functions with different parameters, because of static typing?


Container types in Golang

For a non-OOP language like google Go, is it idiomatic to go about implementing new container types using datatypes like arrays or lists so as to implement convenient functionality like `contains` method which is absent from all in built container types?


java framework for a web wizard

I'd like to create a web wizard or a wizard on/within a website. I know there are several java frameworks for wizards but there is none for the web in particular. If I search for a framework, I always get wizards to create a website, applet, servlet and what not. But never how to create such a wizard itself. So the question(s) is: What framework should I use to create a web wizard? And what frameworks are there? The wizard will be the visualisation for a BPEL Process deployment on a apache ode. I thought a webapp would be an easy way because the apache is running anyway. I'm not bound to that, perhaps someone has a better idea.


Is there a formal definiton of software quality

I am looking for a formal definition of software quality. It is my understanding that ISO 25000 is intended to provide or measure the quality of a piece of software, but it doesn't appear ready yet and I can't tell if it specifically contains such a definiton. Currently ISO 9126 did contain one such definition, but my understanding is that it is being replaced with ISO 25000. So I ask, is there are formal definition of software quality?


"Used with permission" reusable in a GPLv2 derivative work?

The LICENSE file of a GPLv2 application I am modifying contains a statement saying that certain resources used in the application were "used with permission" from 3rd parties - such as textual material from a published book and certain graphics. Question: in my derivative work based off of this application, am I required to seek permission from those 3rd parties to use those same resources? Or does the GPLv2 encompass the fact that the use of these resources was already permitted in the original work, and thus the 3rd-party permission "flows through" to my derivative work?


Namespaces, why are they necessary for prefixes?

So I've been reading about namespace on w3schools and I understand they are to uniquely identify an element. But what is the point of having namespaces if you have to have prefixes along side them. Are you always required to have prefixes with namespaces? If not are you always required to have namespaces with prefixes? If so why? For example:               <root xmlns:h="http://www.w3.org/TR/html4/" xmlns:f="http://www.w3schools.com/furniture">           <h:table>        <h:tr>        <h:td>Apples</h:td>        <h:td>Bananas</h:td>      </h:tr>                    <f:name>African Coffee Table</f:name>         <f:width>80</f:width>         <f:length>120</f:length>       </f:table>     </root>      Doesn't f and h uniquely identify the different element types? Thanks for your help. I'm really at a loss at understanding why namespaces exists.


State Pattern - should a state know about its context?

I am referring to the state pattern as described in this link. In the example class diagram, a context has numerous states. However, it does not show how does a state communicates with a context (perhaps an input in a state has impact on a setting in the context). The two examples on the page shows either passing the context to the state via a function, or storing a reference to the context. Are those advisable? Are there other ways for a state to communicate with a context? * * * Update to an edit: For instance, I am doing a remote control which can have several states. Say, the context has a setting for Volume, and I am in one of the states which allow me to tweak the volume. How should the state communicates with the context that the volume is being changed?


Getting from a user-story to code while using TDD (scrum)

I'm getting into scrum and TDD and I think I have some confusion which I'd like to get your feedback about. Let's assume I have a user-story in my backlog, in order for me to start developing it as part of TDD I need to have requirements, right so far? Is it true to say that the product manager and the QA should be responsible for taking the user-story and breaking it down to acceptance tests? I think the above is true since the acceptance tests need to be formal, so they can be used as tests, but also human readable so that the product can approve they are the requirements, right? Is it also true that I later take these acceptance tests and use them as my requirements, i.e. they are a set of use-cases which I implement (through TDD)? I hope I'm not making too much of a mess but that's the current flow I have in mind right now. **Update**   I think my initial intentions were unclear so I'll try to rephrase. I want to know more details about the scrum flow of turning a user-story into code while using TDD.   The starting point is obvious, a user surfaces a need (or the user's representative as the product) which is a short 1-2 lines description in the known format and that is added to the product backlog.   When there is a spring planning meeting user-stories are taken from the backlog and assigned to developers.   In order for a developer to write code they need requirements (especially in TDD since the requirements are what the tests are derived from).   When, by whom and to which format are the requirements compiled?   What I had in mind was that the product and QA define the requirements via acceptance tests (I'm thinking of automatic using FitNesse or the sort but that's not the core I think) which help to serve 2 purposes at the same time:   1. They define "Done" properly.   2. They give a developer something to derive tests from. I wasn't sure when these were written (before the sprint they're picked then that might be a waste since additional information will arrive or the story won't be picked, during the iteration then the developer might get stuck waiting for them...)


What naming convention for C# file that contains multiple classes?

In C# projects, we frequently group small and tightly related classes into the same `.cs` file. This practice reduces the friction of dealing with a myriad of files containing close to no actual code. Yet, is there an established practice to name the _file_ that contains multiple classes?


Authoritative sources for exception handling best practices

My work place suffers from a bad case of the Pokemon Exception Handling anti- pattern with constructs like the following splattered across the code base:               try {         ...     } catch (Exception ex) {         // Log and pretend nothing happened.         Log.LogException(ex);             }      I've found lots of answers on Stack Exchange sites that explains why the above is bad. But I haven't found any _authoritative_ sources, like books, developer journal articles or msdn pages explaining why you shouldn't write code like the above. Are there any sources like that, if so, where? **Edit** : I'd say that "famous" bloggers also count as authoritative sources. My rule for what counts as authoritative or not is not exactly set in stone.


Why do all <algorithm> functions take only ranges, not containers?

There are many useful functions in `<algorithm>`, but all of them operate on "sequences" - pairs of iterators. E.g., if I have a container and like to run `std::accumulate` on it, I need to write:               std::vector<int> myContainer = ...;     int sum = std::accumulate(myContainer.begin(), myContainer.end(), 0);      When all I intend to do is:               int sum = std::accumulate(myContainer, 0);      Which is a bit more readable and clearer, in my eyes. Now I can see that there might be cases where you'd only want to operate on parts of a container, so it's definitely useful to have the _option_ of passing ranges. But at least in my experience, that's a rare special case. I'll usually want to operate on whole containers. It's easy to write a wrapper function which takes a container and calls `begin()` and `end()` on it, but such convenience functions are not included in the standard library. I'd like to know the reasoning behind this STL design choice.


How would another popular language avoid having to use the factory pattern while managing similar complexity as in Java/Java EE?

Factory pattern (or at least the use of `FactoryFactory..`) is the butt of many jokes, like here. Apart from having verbose and "creative" names like RequestProcessorFactoryFactory.RequestProcessorFactory, is there anything fundamentally wrong with the factory pattern if you have to program in Java/C++ and there is a usecase for Abstract_factory_pattern? How would another popular language (for example, Ruby or Scala) avoid having to use it while managing similar complexity? The reason I am asking is I see mostly the criticism of factories mentioned in the context of the Java/Java EE ecosystem, but they never explain how other languages/frameworks solve them.


Spreading incoming batched data into a real-time stream

I would like to display some events in 'real-time'. However, I must fetch the data from another source. I can request the last X minutes, though the source is updated approximately every 5 minutes. This means that there will be a delay between the most recent data retrieved and the point in time that I make the request. Second, because I will be receiving a batch of data, I don't want to just fire out all the events down a socket once my fetcher has retrieved it: I would like to spread out the events so that they are both accurately spaced amongst each other and in sync with their original occurrences (e.g. an event is always displayed 6 minutes after it actually happened). My thought is to fetch the data every 5 minutes from the source, knowing that I won't get the very latest data. The original data would be then queued to be sent down the socket 7.5 minutes from its original timestamp – that is, at least ~2.5 minutes from when its batch was fetched and at most 7.5 minutes since then. My question is this: is this the best way to approach the problem? Does this problem have any standard approaches or associated literature related to implementation best-practices and edge cases? I am a bit worried that the frequency of my fetches and the frequency in which the source is updated will get out of sync, leading to points where no data will be retrieved from the source. However, since my socket delay is greater than my fetch frequency, the subsequent fetch should retrieve newer data before the socket queue is empty. Is that correct? Am I missing something? Thanks!


SQL string field lengths in a db having about 6 different types of addresses, with about 20 markets and environments

I have been advocating lately that all string fields should be ntext / nvarchar(max) - we're using MS SQL Server. The objections seem to be either "it's not a good idea" (without any reason) or "that would allow the customer to send a lot of crap". Since I believe in filtering out the crap before it hits the database, is there a _good_ reason why my idea is bad? My main argument for not limiting the string fields is that I have discovered that we have about six different types of addresses (customer, reseller and so on), with about 20 markets (each having its own database) and environments. I have spotted at least ten different lengths for say Address1 and the same thing happens for other fields. Instead of "standardizing" them and then discovering that we missed something, I suggested that we go ahead and limit the inputs and let the database handle anything. Does anyone have a pro/con I don't see? (I have seen Rule of thumb for field sizes but my focus is "is making everything max sized wrong?")


Word recognition in a string without spaces or punctuation marks

I have a small C# project that reads a file and gives me an output: a string that does not contain spaces nor any types of punctuation marks. It may also contain a few misspellings. Ex. Output:   THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG **I wonder if there is a way to analyze this string by using text mining/data mining and/or regular expressions to indentify the words (preferably nounds, verbs and so forth.) in the string?** I want to read a bunch of files giving me different outputs and put them in statistical order from the one with the most found words to the one which only contain a string of mumbo jumbo. Also, if the string contain misspellings like:   THEQUICGBROWNFOSJUMPSOVERTHHLAZYDOG   I know that regular expression can calculate the "distans" from a misspelled word and find the most matching one (using a corpus and probability) but this might prove more of a challenge as the string does not have any spaces or punctuation marks. Any ideas how I can solve this?


How can I explain the A a = new B();?

Let's say we have some class structure:                    public interface IA { public void doA(); }          public class A implements IA { public void doA(){ System.out.println("A class doA");}          public class B extends A { public void doA(){ System.out.println("B class doA"); }      And now in a main I state this:                    //in a main          IA ia = new B();          ia.doA();      Am I correct in stating that the the runtime object of `ia` is a B class and it has inherited all the super classes methods and attributes? The printout from within the imaginary main is `B class doA` as the method `doA` in B will hide the same methods in its super classes?


What is the difference between Enumeration and Iterator?

What are differences between Enumeration and Iterator This question is from early ages of interview , I have not seen this question on recent interviews but it was in 2012, now days questions like implementation of HashMap, ConcurrentHashMap etc has take its place, nonetheless its very useful to know fundamental difference between Iterator and Enumeration. Some time its also asked as Iterator vs Enumeration or Enumeration vs Iterator which is same. important point to note is that both Iterator and Enumeration provides way to traverse or navigate through entire collection in java


Should I provide synonyms in an API?

I'm designing a small library and there is a strong temptation to provide synonyms to some of the exported functions.               var foldl = function(){ ... };     var reduce = foldl; //reduce is a synonym for foldl      I imagine that the multiple names might help the initial learnability of the API (since the user is more likely to stumble on the function he wants) but at the same time I worry the duplication will bring needless complexity. **What rules should I keep in mind when thinking about adding a synonym to a function in my API?** When whould I choose a "there is more then one way to do it" api and when should I incentivize there is one way to do it" instead?


How to measure time lost due to environment problems?

I'm trying to determine how we can measure how much time the developers are loosing to poorly managed environment and inefficient ways-of-working. **The goals are:**   1. Show managment how big the problem really is, in terms they can relate to. I.e $$$   2. Get a good baseline so that we can measure the progress.  **Short background:** We manage the programming environment for 500 developers. This includes IDE (mainly Eclipse and Visual Studio), version control systems (ClearCase), what programs they have available. Basically, everything related to the computer that involves programming. Examples: Not being able to work with tools they are used to due to strict security requirements. Using version control system in a bad way causing problems when working in parallell. Setting up project environment is done manually and different each time. Using homecooked frameworks, rather than what are industry standard. Building takes longer than needed due to homemade practices. Deploying takes longer than needed due to homemade practices. This does **not** include the actual coding pratices, project management or meetings. Sure, we can influence those things too, but for this questions those things are out of scope. **The question:** So, how can we determine how much time are lost due to the project environment? The only thing I can think of to get some good data are polls and questionnaires. Have anyone done something like this? What were the experiences and results? Are there other literature or reasearch where I can get ideas from or compare results with? _Other questions exists regarding programmers inefficiency (likethis), but those relate to coding practices and bugs._


Where should I store my Image files for an app

So In my app, I have a bunch of images. And in order to keep the app size down, I could store those images on my serve, and just download and cache them as needed. But my question is, will that hurt user experience? Is it likely an iOS user won't have internet access while using my app?


Mercurial Repository structure with heavyweight corporate comms, configuration management & test requirements

I am yet another Subversion user struggling to re-educate myself in the Tao of distributed version control. When using Subversion, I was a big fan of the project-minor approach, and, with most of my former employers, we would structure our repository branches; tags & trunk as follows:               branches-+              +-personal-+              |          +-alice-+              |          |       +-shinyNewFeature              |          |       +-AUTOMATED-+              |          |                   +-shinyNewFeature              |          +-bob-+              |                +-AUTOMATED-+              |                            +-bespokeCustomerProject              +-project-+                        +-shinyNewFeature                        +-fixStinkyBug     tags-+          +-m20110401_releaseCandidate_0_1          +-m20110505_release_0_1          +-m20110602_milestone     trunk      Within the actual source tree itself, we would use (something like) the following structure:                 (src)-+             +-developmentAutomation-+             |                       +-testAutomation             |                       +-deploymentAutomation             |                       +-docGeneration             |                       +-staticAnalysis             |                       +-systemTest             |                       +-performanceMeasurement             |                       +-configurationManagement             |                       +-utilities             +-libraries-+             |           +-log-+             |           |     +-build             |           |     +-doc             |           |     +-test             |           +-statistics-+             |           |            +-build             |           |            +-doc             |           |            +-test             |           +-charting-+             |           |          +-build             |           |          +-doc             |           |          +-test             |           +-distributedComputing-+             |           |                      +-build             |           |                      +-doc             |           |                      +-test             |           +-widgets-+             |                     +-build             |                     +-doc             |                     +-test             +-productLines-+             |              +-flagshipProduct-+             |              |                 +-coolFeature             |              |                 +-anotherCoolFeature             |              |                 +-build             |              |                 +-doc             |              |                 +-test             |              +-coolNewProduct             +-project-+                       +-bigImportantCustomer-+                       |                      +-bespokeProjectOne                       |                      +-bespokeProjectTwo                       +-anotherImportantCustomer-+                                                  +-anotherBespokeProject      The idea was (and still is) to use the structure of the repository to help structure communication between the engineering team; the customer-facing part of the business and various other stakeholders & domain experts. To wit: Source documents that sit in one of the "project" directories get used (and earn money) only once. Documents that sit in one of the "productLines" directories earn money as many times as a product from that particular line gets sold. Documents that sit in one of the "libraries" directories earn money as many times as any of the products that use them get sold. It makes the notion of amortization of costs explicit, and helps build support for source document reuse across the business. It also means that there is a common structure over which our build automation tools can operate. (Our build scripts walk the source tree looking for "build" folders within which they find configuration files specifying how each component is to be built; a similar process happens for documentation generation and testing). Significantly, the products on which I work typically take a LONG time to run performance measurement & characterization tests; from 20 to 200 hours; generating somewhere between several GB to several TB of processed test results/intermediate data (that must be stored and tied to a particular system configuration so performance improvement over time can be measured). This issue makes configuration management an important consideration, and also imposes some requirement for centralisation, as typically the computational resources needed to run the performance measurement and characterization tests are limited; (a small cluster of 64-128 cores). As one final note; the continuous integration system knows that it needs to trigger a build; static analysis; smoke test & unit test run each time trunk is modified, each time any "tag" branch is modified, and each time any "AUTOMATED" branch branch is modified. This way, individual developers can use the CI system with their personal branches, an important capability, IMHO. Now, here is my question: How can I replicate all of the above (and improve upon it, if possible), with Mercurial. \--edit: My current line of thinking is to use a central Subversion Repository, to define the overall structure, but to allow the use of hg as a client so developers can have repos available locally.


Tell a user whether they have already viewed an item in a list. How?

It is pretty common for a web application to display a list of items and for each item in the list to indicate to the current user whether they have already viewed the associated item. An approach that I have taken in the past is to store HasViewed objects that contain the Id of a viewed item/object and the Id of the User who has viewed that item/object. When it comes time to display a list of items this requires querying the database for the items, and separately querying the database for the HasViewed objects, and then combining the results of these queries into a set of objects constructed solely for the purpose of displaying them in the view. Each e.g li then uses the e.g. has_viewed property of the objects constructed above. I think it is time to find a better approach and would like to know what approaches you would recommend.


Coping with build order requirements in automated builds

I have three Scala packages being built as separate sbt projects in separate repos with a dependency graph like this:                 M---->D       ^     ^       |     |       +--+--+          ^          |          S      S is a service. M is a set of message classes shared between S and another service. D is a DAL used by S and the other service, and some of its model appears in the shared messages. If I make a breaking change to all three, and push them up to my Git repo, a build of S will be kicked off in Jenkins. The build will only be successful if, when S is pushed, M and D have already been pushed. Otherwise, Jenkins will find it doesn't have the right dependent package versions available. Even pushing them simultaneously wouldn't be enough -- the dependencies would have to be built and published before the dependent job was even started. Making the jobs dependent in Jenkins isn't enough, because that would just cause the previous version to be built, resulting in an artifact that doesn't have the needed version. Is there a way to set things up so that I don't have to remember to push things in the right order? The only way I can see it working is if there was a way that a build could go into a pending state if its dependencies weren't available yet. I feel like there's a simple solution I'm missing. Surely people deal with this a lot?


Benefits to using fragments in Android projects

I am learning Android programming and right now and i'm reading about fragments. I understand what fragments are, but either the tutorial is missing some steps or i'm missing something. So my question is when developing an Android UI, what are the benefits, if any, to using fragments as apposed to single page layouts? Are fragments more common than single page layouts or is it more based on the situation. Also, if fragments are more common, do you try to structure most situations so that fragments work?


What do you call parentheses operators?

In most programming languages documentation where they talk about operators `+-*/=<>` they also include `()[]` as operators. There are _unary_ operators, _multiplicative_ operators, _additive_ operators, _bit shifting_ operators, etc. etc. I can find no terminology that separates _parentheses_ operators from the rest of them. Calling them just _parentheses_ operators doesn't seem right, because they can be used in very different contexts. Specify casts, or type conversions.                a = (int)x;      Invoke methods.                fooMethod();      Define order or operations.                x = (2+4)*8;      In the above examples. What is the correct terminology for each type of parentheses. I require this for documentation purposes.


How to document a project which is already developed?

I would like to know what options are available for documenting a project which has already been developed, as the developers who worked on didn't write even a single page of documentation. The project has no other details other than many pages of scripts with functions written and modified by developers who worked on this project from the past 2 years. All I have is the database schema and project files. I would like to know if there is any way to organize this project and document it so that it could be helpful for the developers who will be working on this project in the future. The project was developed with PHP and MySQL. The functions are poorly commented so I can't get good results when I run it with doxygen.


is there an order for resource bundle loading / searching sequence in java

just for a trial, I generate two ResourceBundle, one is a property file MyResourceBundle.properties and the other one is MyResourceBundle.java in the same directory.When I tried to get a key with this code,                   ResourceBundle bundle = ResourceBundle.getBundle("ResourceBundle",currLocale);         System.out.println(bundle.getObject("name"));      The value is brought from the MyResourceBundle.java file. How java decides to get values from in such a situation where all conditions are same ?


How necessary is it to follow defensive programming practices for code that will never be made publicly available?

I'm writing a Java implementation of a card game, so I created a special type of Collection I'm calling a Zone. All modification methods of Java's Collection are unsupported, but there's a method in the Zone API, `move(Zone, Card)`, which moves a Card from the given Zone to itself (accomplished by package-private techniques). This way, I can ensure that no cards are taken out of a zone and simply vanish; they can only be moved to another zone. My question is, how necessary is this kind of defensive coding? It's "correct," and it feels like the right practice, but it's not like the Zone API is ever going to be part of some public library. It's just for me, so it's kind of like I'm protecting my code from myself when I could probably be more efficient by just using standard Collections. How far should I take this Zone idea? Can anyone give me some advice on how much I should think about preserving the contracts in classes I write, especially for ones that aren't really going to be publicly available?


Programming languages and variety

So the issue I have as an undergraduate Software Engineering student, is the topic on which languages must one carry under their belt for future markets. I've been having this debate with teachers and students alike on which language takes the stand. The other debate I've been having is: what does it mean to be "knowledgeable" or "proficient" when it comes to a specific language? More specific:   1. Is it how well you can organize and structure and construct your code, based on the language's syntax, structure etc, but little knowledge about what's under the hood, e.g libraries ?   2. Is it how much experience you've had working with language: graphics, animation, complex projects, vast knowledge of libraries etc. Although this may seem trivial, if a person has never coded in a specific field, such as graphics, does that make him less worthy of a candidate for a job? Does it make the person less "knowledgeable", if you will, in that language? In other words, if you've been working with C# for most of your career, and suddenly are faced with a Java-based project, given that you fall under category 1 (above), would you be worthy to be part of this project? The reason I'm asking this, is because I'm trying to figure what to learn and to what extent. Learning to do animations won't do you any good if you're future career is going to be doing everything BUT that. Or are things in the real world not measured in that way? If I don't make sense, I do apologize as I'm trying to make sense of it myself!


What is the difference between method header and method signature?

I want to know what is exactly a method header and what is a method signature and is this the same among programming languages or just in C#? So, is it correct to say the following is a method header:               public void SumNumbers(int firstNumber, int secondNumber)      and the following is the method signature:               public void SumNumbers(int, int)      ?


Should cookies be used in a RESTful API?

I'm specifically interested in how users perform authorized / authenticated operations on a web API. **Are authentication cookies compatible with the REST philosophy, and why?**


How faster could a dedicated chip do sequential squaring modulo operations to break a time crypto capsule?

I'm facing a very real problem and, sadly, I cannot find the answer on my own: I'm hitting my limit as a programmer because my hardware knowledge is not sufficiently advanced at all. It's an issue I'm encountering during the development of the system (I need to find safe parameters value which depends on the answer to the question I'm asking here) (maybe _crypto.SE_ would be better but _crypto.SE_ seems more about theoretical questions about math/cryptography). For a project I'm working on I need to use a "time capsule cryptosystem". More specifically the following one, invented by Rivest (the 'R' in 'RSA'): Rivest's time capsule crypto puzzle It is an inherently sequential operation: parallelization here is of no use. An attacker could use a botnet of million computers: it wouldn't help. One million ASIC chips wouldn't help either. The solution can only be found sequentially, _by design_. Now I need to approximate (one or two orders of magnitude off is ok: an approximation 10x faster/slower or even 100x faster/slower ain't really an issue) how much faster could a dedicated chip solve that puzzle compared to a fast CPU (a fast _core_ , really). Basically solving that puzzle consists in doing a _lot_ of squarings modulo _n_. Let's consider there's no "attack" on that puzzle: I've chosen bit enough RSA integers etc. Would a GPU help compared to a CPU here? A FPGA? Would a dedicated chip like some ASIC chip help? If any of these would help, how can I determine how much faster it could be than a fast CPU? I'd need some back-of-the-envelope calculation and, as I stated previously, an approximation about 10x or 100x the actual answer ain't that a big problem. I guess my question boils down to something like (but feel free to rewrite if I'm mistaken): knowing that the problem is inherently sequential and consists in repeated squaring modulo `n` operation, can you build/program some hardware to only do sequential squaring modulo operations and how much faster would it be than an actual CPU?


Best practices for coding date sensitive websites

I'm creating a website for an event that is coming up. It has some functionality related to the event (such as "send me a reminder"), other stuff that takes place during the event, and finally some stuff that comes after the event. I need to start working on code that takes place during the event and after the event, plus some fixes for the current site (which is already live). What is the best way to approach this problem? Some solutions that occur to me are creating branches for each state and merging stuff as needed. Other one is hiding and showing functionality based on the date, i.e               if (currentDate < eventDay) { reminder.show(); }      Ideas?


Retexturing a model via API on the web

I'm looking at creating a site where a user could see our product and configure the options or look of it and see an image that represents that. The way I'm doing it now is if you have Piece A selected and then you choose Texture X, I have an image on the filesystem that is A with X applied to it. I just swap out my default image with that specific one. One product has 8 areas, with 10-70 pieces per area, and about 200 textures for each piece. Programming the site was pretty simple but we are getting bogged down in rendering all these pieces/textures and entering them into the system. What I would love to do is build a model and have some way to apply the textures via API and render it to the browser. I would even settle for exporting a flat image and pulling that into the browser. Is that possible with something like SolidWorks, 3DSMax, or something else? If the rendering is too time intensive it would still help to batch create all my images and use them the way I am currently.


Do you use to third party companies to review your company's code?

I am looking to get the following - Basic code review to make sure they follow the guidelines imposed. Security code analysis to make sure there are no loopholes. No performance bottlenecks by doing a load test etc. We have lot of code coming in from third parties and is becoming laborious to manage code reviews and hence looking to see if others employ such practices. I understand that it may be a concern for some and would raise the question "Well, who is going to make sure the agency is doing their job right?" But basically I am just looking for a third party who can hold all vendor code to the same standards.


Is JQuery or Javascript capable for image processing?

My plan is to develop a web based application in the future. I think I can name it "Booth Reservation System" for the Events companies here in our country. One of the main functionality of the system and the most tricky part/difficult part is that the user can upload a "floor plan" (the design of the area were the booth is located in any image format) and then select the specific location on the floor plan to reserve to the booth. Also, the user can create a floor plan on the system. What do you think? What programming language can I use?


What can I do with Ruby beside RoR?

Beside RoR, what do people use Ruby for? Is there any use for Ruby on Windows platform? If you use ruby for scripting why not use Bash or Powershell?


Asp.net certification

I want to get my certification in .NET, which certification is the best for me? For the past 8 months I have been working in the .NET 3.5 and 4.0 frameworks. How can I grow myself by appearing this exams? I know that "certs != experience", but I still want to get certified. Right now I am working in PHP 5.3 and PostgreSQL but I want to switch directions because .NET pays a good salary package as compared to PHP.


What training book should I choose after Microsoft's Application Development Foundation (70-536)?

I've just finished 70-536 ("Microsoft .NET Framework - Application Development Foundation") Microsoft training book from Microsoft Press. I found it quite good. I have also done the 70-528 ("Microsoft .NET Framework 2.0 - Web-based Client Development") book. What book should I be reading next? I am job hunting, so I want to be marketable for a position as a software developer. What will make me stand out from the crowd and get the job?


Does Agile (scrum) require one server environment?

Is it necessary/recommend/best practice/any other positive to use only one server environment to perform all development, unit testing and QA? If so, is it then wise/part of Agile to then have only one staging environment before Live? Considering that this could mean internationally distributed teams of developers and testers in different time zones is this wise? * * * This is something being implemented by our QA manager. The opinion put forward is that doing all the dev and testing on a single server is "Agile." The staging environment would be a second environment, and then live.


Learning the domain-specific knowledge or dig deeper into fundamentals?

## **Context** I've graduated from college a couple of months ago and now I'm working as a software engineer for a company that builds software products. I consider myself lucky that I don't have to work on one of those line-of-business applications. The product we're working on is an authentication solution for - I would say - mass market. I understand that no product could be built without a deep understanding of it's domain. Either it was an industry it's addressing, or a particular set of protocols/use cases/scenarios. In case of a solution like ours, The domain knowledge is a deep understanding of the authentication protocols used by our potential clients, the scale at which it's used, the usage scenarios and other solutions it's going to interact with. ## **The Question** Now as being a relatively new to the industry, what would be your suggestion towards my education? Do you think it's more important to dig deeper into the domain I'm currently working on and dedicate my time to read books, blogs, experiment more in my free time about the set of protocols, standards and tools for building authentication solutions? Or maybe a better idea would be to dedicate my time to get a better understanding of computer science fundamentals that I wasn't taught in detail at the university, like for example:   * The language (C#/C++/Java/anything's) object model, understanding how really my source code is translated to assembly, what is augmented by the compiler, how can I expect thigs to be really laid out in memory (considering all the optimization, tricks, etc.. done by the compiler and/or run-time).   * Advanced multi-threading techniques, knowledge beyond the basics like shared r/w locks, task/data decomposition or basic atomicy/lockfreeness.   * Memory Layouts, Memory models, exact implementations of TEBs.   * Advanced algorithms for massive datasets, how to deal with enormous amounts of data, failure tolerance, etc.. I believe that the second category will make me a better engineer and will help me with designing any sort of product in the future by equipping me with the awareness of their existence - but again - the domain knowledge in the scope of my product is also very valuable and important. I would be thankful for sharing your thoughts on this matter


Aren't structured programming and object oriented programming complementary?

It seems there is a lot of discussion on the web about the differences between these two paradigms, and how OOP is somewhat better than structured programming. But aren't they complementary? From my point of view one could organize his application following OOP principles and implement its logic using structured programming, couldn't he?


Path forward into making Python web applications

I currently know a working knowledge of Python and some related libraries (including the included-with-Python SQLite) for the purpose of making **desktop** applications. I would now like to start to make **"web applications"**. By this, I mean that whatever is on the desktop application will be done by visiting a website...so the web page will have all the same sorts of widgets found in desktop apps (buttons, pulldowns, textboxes, etc). I am **not** interested in making just static web sites or online magazines or things like that. All I know about anything web-related is the basics of HTML and CSS. I also get the sense that I will have to learn Javascript and find a Javascript widget toolkit for the widgets. **I'm unclear on what else I will need.** I've heard a lot of good things about the Django web framework, but I'm not sure what the role of a "web framework" is in the mix here (and I got the sense that Django was used mostly to build things like online magazines, not web applications), though I get the sense I will need one to handle the basics of routing information through the web. I'm also open to the idea of using a different programming language than Python, though I like it and would prefer to keep using it. _I'd like to start simple and make small toy apps just to get the basic ideas, and then build from there._ **EDIT FOR SPECIFIC QUESTION: What are the minimum tools/services will I need to get/learn to produce web apps (as defined above) using Python?** **EDIT 2:** I'm removing references to SaaS. Let's just call it a widget-using web app.


Are there cases where it is a good idea to disallow remote access to a database?

My coworker is working on a project and decided to have the database subside entirely on the glassfish server with glassfish being the only thing that can directly access the database. He will then create web services and a library in Java to access this data. To me that sounds like a horrible way to structure the architecture of one of the most important databases in the company (contains all the employee data). I've mentioned to him that it is a bad idea because it isn't possible to easily get data out currently, to which he said he would write a java library to wrap the REST web service. The problem is that I deal with .NET and I told him that. The web service doesn't work and there is no documentation and currently I have to export data from the database to Excel using PhpMyAdmin and then read it from there since it would take a long time for me to properly format the SQL to work with MS SQL Server. My question is this: does my coworker have a decent design and I'm just suffering because it is in its infancy or am I correct and this design is awful. If it is an awful design, what are points I can bring up to help him see that it may be better to have a more open database?


What is the difference between a Master's in Computer Science and a Master's in Software Engineering?

I am a college student and I am majoring in Computer Science and Applied Mathematics. As I get closer to my senior year, I have noticed that continuing my studies is the best choice right for me now. I see that several universities offer an Computer Science Master's Degree and a Software Engineering Master's degree. What are their pros and cons?


Code bases for desktop and mobile versions of the same app

I have written a small Java Swing desktop application. It seems like a natural step to port it to Android since I am interested in learning how to program for that platform. I believe that I can reuse some of my existing code base. (Of course, exactly how much reuse I can get out of it will only be determined as I start coding the Android app.) Currently I am hosting my Java Swing app on Sourceforge.net and use Git for version control. As I start creating the Android app, I am considering two options:   1. Add the Android code to my existing repository, creating separate directories and Java packages for the Android-specific code and resources.   2. Create a new Sourceforge project (or even host a new one) and creating a new Git repository. a. With a new repository, I can simply add the files from my original project that I will reuse. (I don't particularly like this option as it will be difficult to modify both copies of the same file in both repositories.) b. Or I can branch the original repository. This adds the difficulty of merging changes of shared source files. Mostly I am trying to decide between choices 1. and 2b. If I'm going to branch the existing repository, what advantages are there to hosting it as a separate SF project (or even using another OSS hosting service) as opposed to keeping all my source code in the current SF project?


Forking an open source project using Git

There is an open source project that I want to fork for my own reasons. It currently has a Git mirror of its main SVN repository which I can use. What are the best techniques for forking a project whilst still maintaining the ability to merge future changes from the original project into your own forked repository using Git? Please note I will not be using Github at all for development so using any features from that is out of the question. The project will be hosted on a private VPS.


Is Unix/Linux adoption a measure of developer skill?

Is Linux/Unix based OS adoption for development (or recreation) a rough measure of the awareness, adaptability and/or skill of a developer, after considering factors like learning curve for effective code testing via the CLI, basic scripting, tweaking, etc.


How to structure an application that combines WCF and WPF

I'm in the process of learning how to use WCF (Windows Communication Foundation) to allow a client/server desktop application to communicate. The application's UI will be implemented using WPF, and we will probably use SQL Server for our database. What I'm struggling with, is understanding how to structure such an application. From what I've read, there are three components of a WCF application (which in the examples I've seen have existed as separate projects):   * A WCF service   * A WCF service host   * A WCF service client My question then, is - should these projects solely implement the functionality of sending/receiving data from the client/server? Would it make better sense this way? Would it make sense to create a separate WPF (Windows Presentation Foundation) project to implement the UI for the application? And so, when I need to send/receive data from the client/server, I could simply invoke the operations provided in the WCF projects that I have created? For anyone who has built similar applications previously, perhaps you could explain what worked best for you in terms of structuring your application? For example, if I create a user registration page. When the user clicks the 'Register' button, the client application will need to send the data to the server. In this case, could I just invoke the methods provided in the WCF projects to send the data? Also, what data structures worked best for you when sending/receiving data? My initial thought is sending/receiving XML containing the data. Is this an option that is easy to implement? I realise that answers to this question may well be a matter of opinion - unless there are specific best practices that I'm not aware of. Thank you


Should I be coding this myself?

As I've always liked doing things myself, I chose to code in C++ rather than Visual Basic at university because I could see what was going on and how it worked. However, sometimes I feel like I'm wasting my time though, as there are so many 3rd party libraries out there. Here's an example of what I mean. A while ago I created my own collision detection function based on the x,y coordinates of the mouse and the dimensions of the sprite looping through each line checking for visibility of pixels. About a fortnight later I found out that there is already an identical function built into DirectX. Doing it your self helps you understand how it does it but you cant possibly understand everything about programming, there's to much and it keeps changing. Being young and relatively new to the commercial world I was wondering what experienced professionals opinion was on when to code something yourself and when to just used what's out there?


What markup languages are good for programming articles/tutorials?

I very much wish to write a programming tutorial in my native language (Latvian). There are far too few of those. I am however unsure on what markup language to use for writing it. Here are a few things I would like to achieve:   * The same source can be compiled to both HTML for online viewing and printed form (PDF?). In HTML form it would allow superior interaction and appearance (see below), while the print form would look good on paper (layout etc).   * I have the idea that the tutorial could be multi-language. Different students have different requirements in their schools. For example, some schools teach Java, some teach C#. You could choose the language on the top of the HTML page and the relevant code snippets (and occasionally pieces of text) would swap out. Most of the text is the same anyway, only the language syntax is a bit different.   * The text would occasionally contain images too of course and these would need to be included in both the HTML and the printed version   * In the HTML version the code snippets should get automatic syntax coloring which should ideally be the same as in the recommended IDE for the tutorial. In case there are ambiguities, hints for the syntax colorer should be possible, but I don't want to do the whole coloring by hand.   * "Output" syntax coloring which would emulate a standard 80x25 text console (since many of the initial programs would be console applicatioins)   * Collapsible sections for answers to questions (aka "spoiler tags")   * Automatically generated index/table-of-contents   * Links to other parts of the tutorial (rendered as links in HTML and as references in print version)   * "Side note" sections, rendered as separate blocks on the side.   * Other functions useful in publications that I'm not aware of :) I know this is a bit much to ask, but is there something close enough that I could take it as a starting point and add the necessary features myself? Or is there something in the whole list (like the desire to have both HTML **and** print versions from the same source) that makes it all fundametally infeasible?


Notifying a separate application of an event

I have an application that runs through various tasks as an automated process. My client would like me to create a file in a given folder for each task as a way to flag when each task completes. They prefer this to a database flag because they can be notified by the file system rather than continually polling a database table. I can do this but creating and deleting files as flags feels clunky. Is there a more elegant approach to notifying a third-party of an event?


how do you manage api keys?

I have a few projects that use various webservices e.g. DropBox, AWS. For managing private information I use `bash_profile` which works great with heroku that uses env variables to manages secret informations. The problem is my bash_profile is growing significantly (HEROKU_ADD_ON_1 HEROKU_ADD_ON_2 etc.) and it bit me today. What's the better way?


Should a developer be allowed to use VSS if he prefers it?

I introduced Mercurial to my department. I love it, but it is my first version control experience. I am using it with NetBeans PHP for web development. Another developer who works on internal company applications likes using Visual Source Safe and does not want to switch. He works in a Visual Studio environment. All the other developers have bought into Mercurial except this one. For the most part though, we all work pretty independently. I am trying to move this department in the right direction, I have set everyone up with an account on Kiln, I was hoping to get everyone using Fogbugz down the road as well (since there is currently no bug database being maintained.) I have never used VSS but I hear very bad things about it. Would it be better to just allow him to continue using VSS if that's what he prefers, or would it be in best interest to get him on board with Mercurial?


Decorator not calling the decorated instance - alternative design needed

Assume I have a simple interface for translating text (sample code in C#):               public interface ITranslationService     {         string GetTranslation(string key, CultureInfo targetLanguage);         // some other methods...     }      A first simple implementation of this interface already exists and simply goes to the database for every method call. Assuming a UI that is being translated at start up this results in one database call per control. To improve this, I want to add the following behavior: > As soon as a request for one language comes in, fetch _all_ translations > from this language and cache them. All translation requests are served from > the cache. I thought about implementing this new behavior as a decorator, because all other methods of that interface implemented by the decorater would simple delegate to the decorated instance.   However, the implementation of `GetTranslation` wouldn't use `GetTranslation` of the decorated instance _at all_ to get all translations of a certain language. It would fire its own query against the database.   This breaks the decorator pattern, because every functionality provided by the decorated instance is simply skipped. This becomes a real problem if there are other decorators involved. My understanding is that a Decorator should be additive. In this case however, the decorator is _replacing_ the behavior of the decorated instance. I can't really think of a nice solution for this - how would you solve it? Everything is allowed, even a complete re-design of `ITranslationService` itself.


How to serialize and deserialize lambda expression in F#?

I serialized lambda expressions in C# before. Now I wanna use F# instead of C# for serialization and deserialization. I heard F# is better in this area. Is it true? How can I do that with F#? I’d appreciate even if you just suggested a correlated link.


Big-O of this algorithm?

1. How can I describe the growth function in terms of n for the following algorithm?   2. What is the bounding function (the Big-O)? Is it O(n^3)? * * *               for(i = 0 to n - 1)     {         c = i + 1         for(j = c to n)         {             arr[j] += arr[i];                  for(k = c to 0 step -1) // what does the keyword "step" mean?             {                 arr[k] *= arr[j];             }         }     }


Are there any resources on how to identify problems that could best be solved with templates?

I decided to improve my knowledge in template meta-programming. I know the syntax and rules and been playing with counteless examples from online resources. I understand how powerful templates can be and how much compile time optimization they can provide but I still cant "think in templates", I can't seem to know by myself if a certain problem could be best solved with templates and if it can, how to adapt that problem to templates. Is there some kind of online resource or book that teaches how to identify problems that could best be solved with templates and how to adapt that problem?


Should we compile our website to a single dll, or a dll per page?

We're developing a new project that is to be deployed on a large number of client sites. The project contains a web-based GUI as one of it's "access points". Speed of the web interface is a priority for this project, second only to security. In the past, we've always created "web sites" in Visual Studio, which, when published, results in one dll and one aspx file for each page within the system. However, I am aware that you can actually create a "web application" and have it compile everything down to a single dll. To me (based on no real data, just gut feeling), compiling the site as a single dll sounds like it would be better for both security and speed (if only marginally). What are the considerations we should look at, and are there any obvious pitfalls we should be aware of when choosing the method that's right for us?


Reporting in Visual Studio 2010 Express

I want to download Visual Studio 2010 Express Edition to learn all that is new in it. I find it insufficient as there is no Crystal Reports integration in it. Apart from that I want to learn other enterprise features that are bundled with the Professional Edition. If I download the VS 2010 Professional Edition, it is just limited to 90 days. Is there any other alternative for learners? Also, is there any FREE alternative for reporting in Express Edition.


Is MUMPS alive?

At my first workplace we were using Digital Standard MUMPS on a PDP 11-clone (TPA 440), then we've switched to Micronetics Standard MUMPS running on a Hewlett-Packard machine, HP-UX 9, around early 90's. Is still MUMPS alive? Are there anyone using it? If yes, please write some words about it: are you using it in character mode, does it acts as web server? etc. (I mean Caché, too.) If you've been used it, what was your feelings about it? Did you liked it?


How does a website like Mathway work?

I recently found a website called Mathway Basically, it works by allowing you to choose your "level of math" (which it uses to determine what tools it should provide to you) and then allows you to input a math problem which it then solves for you, and gives you detailed solutions (you have to try it, it's really cool). I was wondering how it worked on two levels. First off, how would they parse the math problem (and all the sometimes foreign mathematical operators)? How do they get from text to numbers, variables, and operators? Second, how do they generate the explanations? While you have to pay for the detailed solutions (which are explanations of how they solved the problem), I've seen their preview screenshots, and it looks very detailed. The explanations are given in full, accurate sentences. How would they generate something like that?


Hallmarks of a Professional PHP Programmer

I'm a 19 year old student who really REALLY enjoys programming, and I'm hoping to glean from your years of experience here. At present, I'm studying PHP every chance I get, and have been for about 3 years, although I've never taken any formal classes. I'd love to some day be a programmer full time, and make a good career of it. My question to you is this: What do you consider to be the hallmarks or traits of a professional programmer? Mainly in the field of PHP, but other, more generalized qualifications are also more than welcome, as I think PHP is more of a hobbyist language and may not be the language of choice in the eyes of potential employers. Please correct me if I'm wrong. Above all, I don't want to waste time on something that isn't worth while. I'm currently feeling pretty confident in my knowledge of PHP as a language, and I know that I could build just about anything I need and have it "work", but I feel sorely lacking in design concepts and code structure. I can even write object oriented code, but in my personal opinion, that isn't worth a hill of beans if it isn't organized well. For this reason, I bought Matt Zandstra's book "PHP Objects, Patterns, and Practice" and have been reading that a little every day. Anyway, I'm starting to digress a little here, so back to the original question. What advice would you give to an aspiring programmer who wants to make an impact in this field? Also, on a side note, I've been working on a project with a friend of mine that would give a fairly good idea of where I'm at coding wise. I'm gonna give a link, I don't want anyone to feel as though I'm pushing or spamming here, so don't click it if you don't want to. But if you are interested on giving some feedback there as well, you can see the code on github. I'm known as The Craw there. https://github.com/PureChat/PureChat--Beta-/tree/


REST API wrapper - class design for 'lite' object responses

I am writing a class library to serve as a managed .NET wrapper over a REST API. I'm very new to OOP, and this task is an ideal opportunity for me to learn some OOP concepts in a real-life situation that makes sense to me. Some of the key resources/objects that the API returns are returned with different levels of detail depending on whether the request is for a single instance, a list, or part of a "search all resources" response. This is obviously a good design for the REST API itself, so that full objects aren't returned (thus increasing the size of the response and therefore the time taken to respond) unless they're needed. So, to be clear:   * **.../car/1234.json** returns the full Car object for 1234, all its properties like colour, make, model, year, engine_size, etc. Let's call this _full_.   * **.../cars.json** returns a list of Car objects, but only with a subset of the properties returned by .../car/1234.json. Let's call this _lite_.   * **...search.json** returns, among other things, a list of car objects, but with minimal properties (only ID, make and model). Let's call this _lite-lite_. I want to know what the pros and cons of each of the following possible designs are, and whether there is a better design that I haven't covered:   1. Create a Car class that models the _lite-lite_ properties, and then have each of the more detailed responses inherit and extend this class.   2. Create separate CarFull, CarLite and CarLiteLite classes corresponding to each of the responses.   3. Create a single Car class that contains (nullable?) properties for the _full_ response, and create constructors for each of the responses which populate it to the extent possible (and maybe include a property that returns the response type from which the instance was created). I expect among other things there will be use cases for consumers of the wrapper where they will want to iterate through lists of Cars, regardless of which response type they were created from, such that the three response types can contribute to the same list. Happy to be pointed to good resources on this sort of thing, and/or even told the name of the concept I'm describing so I can better target my research.


PCI Compliance with Offshore Developement

I run an offshore development team that produces a host of financial products. We are currently planning the work needed in order to gain PCI compliance. The offshore team is run by an outsourcing operation who employ the staff directly. In other words the developers are not directly employed by us, but are exclusivly resources to projects for our company. All our infrastructure is UK based (source control, development machines etc). Developers/Testers offshore remote desktop to the development environments they need to use. Is there anything in this setup that we should be concerned about from a PCI point of view? We have just started researching but I cannot find anything related to these points so any advice would be apprciated. Thanks!


OPTION STRICT set to off

I am working on an application with over one million lines of code. OPTION STRICT is set to off!. I want to set it to ON during the next work iteration. I believe the only reason OPTION STRICT should be OFF is when converting a legacy system e.g. VB6 to .NET. You should then set OPTION STRICT to ON ASAP. Am I right in this thought or do developers leave OPTION STRICT to OFF permanently? Is there any guidance. I have looked here: http://msdn.microsoft.com/en-us/library/zcd4xwzs.aspx, but I cannot find an answer to my specific question.


What Http verb should the route to log out of your web app be?

Browser support issues aside, if you're being an Http/hateoas stickler what verbs should the request to log into/out of a site be? DELETE would seem like the obvious choice but I'm not sure what the resource you're deleting would be.


How to respond when you are asked for an estimate?

We, as programmers, are constantly being asked 'How long will it take'? And you know, the situation is almost always like this:   * The requirements are unclear. Nobody has done an in depth analysis of all the implications.   * The new feature will probably break some assumptions you made in your code and you start thinking immediately of all the things you might have to refactor.    * You have other things to do from past assignments and you will have to come up with an estimate that takes that other work into account.   * The 'done' definition is probably unclear: When will it be done? 'Done' as in just finished coding it, or 'done' as in "the users are using it"?   * No matter how conscious you are of all these things, sometimes your "programmer's pride" makes you give/accept shorter times than you originally suppose it might take. Specially when you feel the pressure of deadlines and management expectations. Many of these are organizational or cultural issues that are not simple and easy to solve, but in the end the reality is that you are being asked for an estimate and they expect you to give a reasonable answer. It's part of your job. You cannot simply say: I don't know. As a result, I always end up giving estimates that I later realize I cannot fulfill. It has happened countless of times, and I always promise it won't happen again. But it does. What is your personal process for deciding and delivering an estimate? What techniques have you found useful?


How do you deal with time estimates?

If given too little time, quality suffers. If given too much time, developers will find a way to use all alloted time, no matter what. What would be a good way with dealing with estimates? Are they a necessary evil?


When will be your project finished? How long does it take to complete it? Any idea how do you estimate such timing on the spot?

> **Possible Duplicate:**   >  How to respond when you are asked for an estimate? In my company, i have a strange managers, they always asks me before starting how is it going? And how long it will take to finish? From Day 1 to end of the project life. Behind the screen they do not have any idea what language i will need to use. I was myself forced to use PHP, C, Java, Vala, D, Bash, many other platforms etc etc, where i was only a Visual basic 6.0 programmer. But it takes me lot of time to complete a project, because i care about it before releasing, requires lot of testing etc etc. The problem is, i still do not have any best answer when someone asks me "how long do you think it will take to finish this project?", although i have done lot of projects. But i can not answer such questions, because in my mind its never finished, i always wanted to do more and more optimized code even after release. I would like to know how you guys tangle this question? (as pro-programmer way)


Is SOA suitable for developers or only for business/IT management people?

Let's suppose you're the lead of a team of developers that needs to build a big information system such as an ERP or Human Resources software, or whatever system that is composed by multiple business modules. The system must delivered quickly, be scalable and have good evolution and maintenance capabilities. Your team has experience on SOA technologies and also on development of standard MVC/AJAX applications in ASP.NET, Spring, ExtJS, Smartclient or whatever mix of frameworks. You also have a good project manager in your team. Your stakeholder is baffled with so many technologies and changes in industry that he doesn't care about which thing you use, as long as the functional and non-functional requirements are satisfied. Would you use SOA practices (such as governance, service repository, service identification/discovery) and SOA infra-structure elements (such as an ESB, a BPEL engine, WSDL-base web services)? Or would you just use an agile and disciplined development process with your favorite/trustworthy frameworks and provide some RESTful services and other simple integration points with external systems? Or something else?


What and how to unit test a django web application?

I am writing unit tests for a web frontend implemented in Django. I have written unit tests that check that all views return the correct status code (200, 302 etc) so that template errors (which give 500) are found. I also do HTML validation with `tidylib`. What else is there I should (or _can_ ) do? Models are unit tested elsewhere, forms have dependencies (namely on models) so is there way to unit test them - in general case there is something one can do, but what can I do (without a huge effort) leveraging the Django/python unit test framework?


Separation of concerns in an RMR framework

I'm working on a new framework for PHP that utilises an architectural pattern called RMR, instead of the more common (pseudo)-MVC that most PHP frameworks currently implement. So far it feels like a better fit for web-apps than MVC was. I'm currently separating the various concerns involved with managing a page request/response cycle and have so far implemented objects for form validation, representing the request, representing the response, a front controller to wrap a complete HTTP request/response, a resolver to route a request to the appropriate resource and so on. This has led to an interesting question regarding separation of concerns, however. In an MVC framework I'd normally have a form validation object and a business object (model) wrapped in a controller action. The action would validate the input and hand it off to the business object if it passed validation, or back to the view for error display. However, in RMR, there is no controller. The architecture I'm considering has a form validation class like the MVC frameworks such as zend, but without a controller there isn't an obvious place to invoke it. I could invoke the form validation object from within the resource (the RMR equivalent of a model), but this feels wrong, because the resource needs to know more about how it's going to be used in this case. I know from the description of RMR that this isn't completely avoidable, the resource has to be able to understand a HTTP request, but I'd rather keep it to a minimum if at all possible so that resources can still be used outside of the context of the RMR framework without major modification. I could do form validation in the object that encapsulates the HTTP request, but this implies that the request object needs to know how the resource is intending to use the given input. For example, a resource representing a blog entry may allow comments to be added, votes to be collected or the original poster to edit it. If all three kinds of operations are submitted via a POST then the request object will need to be able to determine whether the given POST is for editing the blog, adding a comment or submitting a vote. If more functionality is added to the blog article resource, or if some functionality is removed, then the request needs to know about it. This seems to break encapsulation. I also considered moving form validation to the front controller, but this would have similar problems to having it in the request object. The front controller would need to know something about the inner workings of the resource before it could validate input for it. If anyone has any alternative approaches or commentary regarding this problem I'd appreciate any input you have. Maybe this problem is just highlighting that the approach I used in the past with MVC was wrong, and having form validation in the controller wasn't the proper way of doing things?


How should "git add /**" work?

As noted in this question, I ran into an issue with `git add /**...`. I can't actually find any documentation on the "/**" form of path specifications - possibly because it's hard to google. How is it meant to work, exactly? I'm particularly curious that `git add /\*\*.py` can work but `git add /path/foo.py` won't - why is the slash allowed at the start of the string with the ** notation? EDIT more info:               $ echo /**.py     /**.py      (This version of Bash doesn't support `shopt -s globstar`) Yet:               $ git add /**.py      adds (silently) a file three directories beneath the current directory. Git apparently doesn't do any globbing at all, so I'm really curious what's going on here. These also work:               `git add '/**.py'`     `git add /*******.py`       This doesn't:               `git add **.py`      This seems to add all files anywhere in the current working directory. (Bash 3.2.48 on OSX)


Single Responsibility Principle and higher levels of abstraction

Two common phrasings for the Single Responsibility Principle (SRP) are "each module should be responsible for a single feature or functionality in a system", and "each module should have only one reason to change". My questions is: is this something that we should absolutely strive for in every class of a system, or should it be relaxed when we combine lower-level modules to compose the more abstract modules? At the extreme case, the top-level module in a system will be responsible for the entire gamut of system functions, so it looks like it may not be possible to respect the SRP in this kind of module.


Kerberos for key management?

We have half-implemented proper key management at our dev shop. We have a SOAP web service (the **key management web service** ) that can be used to retrieve passwords for other systems. So for instance, I might make a request to this service for the password to, say, a production PostgreSQL DB. I hit the web service with my AD credentials, and it determines whether I'm authorized to receive the DB password or not. If I am, then it is sent in the response. I can then use this service across all other software components instead of storing the DB password in a static config file (like Tomcat's `context.xml`, etc.). The problem, of course, is that with an automated process the AD credentials passed into the web service need to be stored somewhere. So, to obtain the password to a DB (or any other secured resource), one simply needs to gain access to what is used to store the AD credentials, and can then submit them to this web service, which will then authenticate/authorize them, and return the password for the requested resource. Classic key management problem. Hence, I'm trying to figure out a way to protect the AD credentials used to access the service. Someone mentioned Kerberos to me and I've began to dig in a little bit. My _understanding_ is that, with Kerberos, there would be 3 components:   * A **client** of the key management web service   * The key management web service   * A Kerberos (ticket granting ticket, **TGT** ) server My _understanding_ is that:   1. The client (somehow) obtains a TGT from Kerberos   2. The client then issues a a request for some resource, say, a DB, to the key management web service, but does _not_ supply any AD credentials, but instead, supplies the TGT   3. The key management web service is then reconfigured to take this TGT and ping the Kerberos server with an " _is this TGT valid?_ "-type request   4. The Kerberos server responds and says " _yes_ " (or "no") and honors the request for the DB password, sending it back to the client in the response So first, if anything about my understanding is incorrect, please begin by correcting me! Assuming I'm more-or-less correct, then I have a few questions about this setup:   1. How would the client first obtain the TGT from Kerberos?   2. Do Kerberos TGT's have expiration dates? How would then client "re-request" a new TGT?   3. Does the key management web service need to implement any specific TCP protocol to speak with Kerberos, or does HTTP suffice? If Kerberos has its own protocol, are there any Java libs that implement it? (I know its easy to Google "java kerberos" but not sure what specifically to be looking for because again, I'm not confident I understand the architecture here).


How to safely copy an object?

This question is going to be a little long. Please bear with me. Something that happened in a project of mine made me think about how to safely copy objects. I'll present the situation I had and then ask a question. There was a class `SomeClass`:               class SomeClass{         Thing[] things;              public SomeClass(Thing[] things){             this.things = things;         }              // irrelevant stuff omitted              public SomeClass copy(){             return new SomeClass(things);         }     }      There was another class `Processor` that takes `SomeClass` objects, copies them (via `someClassInstance.copy()`), manipulates the copy's state, and returns the copy. Here it is:               class Processor{         public SomeClass processObject(SomeClass object){             SomeClass copy = object.copy();             manipulateTheCopy(copy);             return copy;         }              // irrelevant stuff omitted     }      I ran this, and it had bugs. I looked into these bugs, and it turned out that the manipulations `Processor` does on `copy` actually affect not only the copy, but also the original `SomeClass` object that was passed into `processObject`. I found out that it was because the original and the copy shared state - because the original passed it's field `things` into the copy when creating it. **This made me realize that copying objects is harder than simply instantiating them with the same fields as the original.** For the two objects to be completely disconnected, without any shared state, each of the fields passed to the copy also has to be copied. **And if that object contains other objects - they have to be copied too. And so on.** So basically, in order to be able to actually copy an object, **each class in the system must have a`copy()` method, that also invokes `copy()` on all of it's fields, and so on**. So for example, for `copy()` in SomeClass to work, it needs to look like this:               public SomeClass copy(){         Thing[] copyThings = new Thing[things.length];         for(int i=0; i<things.length; i++)             copyThings[i] = things[i].copy();         return new SomeClass(copyThings);     }      And if `Thing` has object fields of it's own, than it's own `copy()` method must be appropriate:               class Thing{         Apple apple;         Pencil pencil;         int number;              public Thing(Apple apple, Pencil pencil, int number){             this.apple = apple;             this.pencil = pencil;             this.number = number;         }              public Thing copy(){             // 'number' is a primitve.             return new Thing(apple.getCopy(), pencil.getCopy(), number);         }     }      And so on. Of course, instead of all classes having a `copy()` method, the copying mechanism can happen in all of the getters and the constructors of classes (unless places where it isn't suitable, for example when the field points to an external object, not to an object that 'is part' of this object). Still, that means that in order to be able to safely copy an object - most classes would have to have copying mechanisms in their getters. **My question is divided into two parts:**   1. How frequently do you need to get a copy of an object? Is this a regular issue?   2. Is the technique described common and/or reasonable? Or is there a better way to make safe copies of objects?


How should a GUI application written in WinAPI be structured and organized?

I've done an extensive amount of GUI programming in Winforms and WPF using C#, and a tiny bit in C++ using MFC. I'm building a personal project using WinAPI mainly to gain a deeper knowledge in Windows Programming. I've found myself quickly stuck on how to organize the project because making even a simple windows application in WinAPI only takes a lot of boilerplate coding in just making UI elements. This wasn't much of an issue in Winforms or WPF since the framework itself somewhat forces you to separate the view and logic, making it easier to organize the code. Are the any recommended patterns / methods on how I should organize WinAPI projects? More specifically, how should I separate the logic between the UI elements and logic in Windows Programming? I'd also love to see any resources and examples on this.


C++ ofstream adding random data to a file!

Here is my code:               std::ifstream file2(imageToAdd.c_str(), std::ios::in | std::ios::binary);     if(file2){         file2.seekg(0,std::ios::end);         length = file2.tellg();         file2.seekg(0,std::ios::beg);         vector<char> tempImageVec(length);         file2.read(&tempImageVec[0],length);         int totalFileUpload=0;         std::ofstream f("test.data");         f << (char)1;         totalFileUpload+=1;         vector<char> AddImagesize=print4Bytes(length);         for(int i=0; i<AddImagesize.size(); i+=1){             f << (char)AddImagesize[i];         }         totalFileUpload+=AddImagesize.size();         for(int i=0; i<tempImageVec.size(); i++)             f << tempImageVec[i];         totalFileUpload+=tempImageVec.size();         cout << totalFileUpload << endl;     }      As you can see, totalFileUpload should be count the amount of data that gets put into the file, however in this case, i add a file (Around 1.33mb), the cout statement outputs: 1,405,202 bytes However opening the fine in a program such as notepad++, or just viewing the properties of the file, shows that the file is now 1,409,439 So where did this extra 4,237 bytes come from? The only obvious thing i could spot was the possibility of the length of the file being read being incorrect, however it is correct, as it was the same as when i viewed the properties.


When doing social application development, is it ok to use my company credentials for all client work?

As a web application developer, recently my work in creating Social Applications has taken a lot of momentum (specifically, Social Login buttons.) Is it ok to use my company's social network developer credentials for this? I don't want to sign each client up for between 1 and 20 different services based on their needs. It's a lot easier to just open up my Google Console and click 'new.'


Is there a common programming term for the problems of adding features to an already-featureful program?

I'm looking for a commonly used programming term to describe a software- engineering phenomenon, which (for lack of a better way to describe it) I'll illustrate first with a couple of examples-by-analogy: Scenario 1: We want to build/extend a subway system on the outskirts of a small town in Wyoming. There are the usual subway-problems to solve, of course (hiring the right construction company, choosing the best route, buying the subway cars), but other than that it's pretty straightforward to implement the system because there aren't a huge number of constraints to satisfy. Scenario 2: Same as above, except now we need to build/extend the subway system in downtown Los Angeles. Here we face all of the problems we did in case (1), but also additional problems -- most of the applicable space is already in use, and has a vocal constituency which will protest loudly if we inconvenience them by repurposing, redesigning, or otherwise modifying the infrastructure that they rely on. Because of this, extensions to the system happen either very slowly and expensively, or they don't happen at all. I sometimes see a similar pattern with software development -- adding a new feature to a small/simple program is straightforward, but as the program grows, adding further new features becomes more and more difficult, if only because it is difficult to integrate the new feature without adversely affecting any of the large number of existing use-cases or user- constituencies. (even with a robust, adaptable program design, you run into the problem of the user interface becoming so elaborate that the program becomes difficult to learn or use) Is there a term for this phenomenon?


Best way to charge for redevelopment contract?

I took on a new project, and the task is to redevelop an existing application. I have been already working on the redevelopment for 6 weeks. I originally bid a fixed price for the first phase of development, despite the fact that the specifications they provided me with were pretty vague. It turns out what was supposed to take me only 4 weeks (which is what I based the bid on) ended up taking 6 weeks. In addition, there's still yet some work to do on the first phase, but the client has said they will pay me for the first phase anyway as it's taken longer than anticipated, and because I handled a bunch of extra, undocumented work. As you can see, I am finding fixed price challenging with this project. My question is what is the best way to bill for large programming projects you will be doing remotely? I have been considering hourly, daily, weekly and monthly. I sure find it challenging to accurately predict the amount of time something will take.


What are the chances of getting a good development job without the training in solving programming puzzles?

By "good job" I mean mostly a job that is well paid and involves the development of market-leading products/services (of course within my area of interest). I have a masters degree in economics and no formal education in computer science. I'm a completely self-taught programmer. I do have a few small projects that do solve a real-problem in my portfolio, as well as one year long "career" at some company as a junior programmer. So I expect that when interviewing for another job I will be given some qualifications test. **What are the chances that I will be given programming puzzles to solve?** (I'm interested in Europe mostly, if there are some big differences geographically.) I've seen a few of those and I'm positive I wouldn't be able to solve 90% of them on the spot, with a blank sheet of paper and no internet or book references. Add to that the stress of the interview. To tell the truth, I think only a very small percent of the population is able to solve those with no preparation - the rest passes them because they practice. During my studies I did have courses that required solving some economic optimization case studies, which were based on algorithms (although different from those typically associated with programming), so I know that the best method of learning how to solve such puzzles is solving a large number of them. Problem is, I believe it may take at least 6 months of full time study to practice some most often encountered puzzles, so that I have a fairly good shot at passing most interviews. And I'm a very practical guy, who values his time greatly. My economic gut tells me that I'd rather spend 6 months of my time polishing a commercial project, that I've been working on, rather than developing my "interview passing skills". Don't get me wrong. I am aware of the hard science behind programming. I do have a collection of books that I consult very often as soon as I encounter a mathematical/algorithmic problem, I do know where and how to ask questions, sometimes I do even browse PhD-level research papers (if I have an important but specific problem). But reading the whole Cormen's or Knuth's book and solving the puzzles in those books? I'm not that kind of guy and even if I were, I don't have time for this. I do fairly well in tests that target primarily the language or API, especially C++. That is because I work with them every day, and C++ being quite dangerous, I kind of had no choice but to master it. That was needed to complete a real life problem. On the other hand, it took me 3 years to come across a situation where I had to pick the most appropriate sorting algorithm and adapt it for my needs. Which leads me to think that if I don't explicitly train to solve camouflaged specific sorting algorithm puzzles, then I won't be able to solve them during interviews. Note that I cannot simply go to every interview and try my chances, as I live in the middle of nowhere and usually an interview is a major logistical challenge and a strain on my time (mostly the whole trip takes 3 days) and money.


How to set up for selective pushing with Mercurial?

I have a situation, when I'm working on a project, but at same time small issues arise which require quick fix. I would like to push just the fixes for these problems to the main repo while keeping the rest locally. Problem is that, as I've already found out, it's not possible to cherry pick changsets when pushing from my repository upwards. So the question is, how to set up my Hg environment to have such a possibility. I want to preserve all the Hg metadata, so sending patches around is not a option. BTW, if the whole thing can be managed directly from MercurialEclipse, that would be a big plus.


The state of build systems in Java

Is anyone else out there sick of the state of current build systems in the Java space? Why shouldn't I just write my next project's build scripts in Python, Ruby or another fully feature scripting language and get back some of that control? Does anyone have any experience in putting something like this together? If so did it work out well or was it a disaster?


When to delete a branch in Git

I have a script project I've been managing with Git. Besides two main branches, several minor branches have been introduced over time to cover minor features, tweaks or temporary changes. Some of these branches are nearing end- of-life, and I won't be updating them any more. What's the different philosophies for handling branches like this? Should they be removed, or left in the repository unmaintained? If I do, won't I end up with a cluttered repository?


Is TCP/IP an OSI Replacement or both are inter-dependent and meant to work together

I'm confused in differentiating the OSI Model and TCP/IP suite. As per my knowledge. OSI is a structure on top of which Networks are built and TCP/IP is the suite of protocols that operate on these 7 layers of OSI. Correct me if I'm wrong. Also, is TCP/IP a replacement to OSI and is used **IN PLACE** of OSI? or both these work **COLLECTIVELY** to form the Network? any good source to clarify my confusion will be appreciated. Thanks.


Is a traditional client app which connects directly to a database a good idea?

After using Django's excellent admin interface, I was pondering creating a similar system which wasn't as tied to an ORM. Now, while considering this, I thought that overcoming webapps limitations (basic widgets, sessions, text/HTTP-based forms, distinct client-side/server- side languages in most cases with a limited communication mechanism, etc.) were a big timewaster, and that maybe traditional GUI development was a better option. So that brought me to using a desktop app, and then a server part which connects to the database and exposes it via RPC (web services, whatever) to the desktop app, handling security in the traditional webapp fashion. However, nowadays you can connect to databases remotely securely using SSL, and supposedly databases do provide sufficient role-based authorization (GRANT/REVOKE), so why not connect directly to the database and avoid having to code a server? Is that a good idea? Are there unassailable problems with this approach? [I think that coupled with good database introspection, one could write a relatively simple framework which would enable very nice RAD of database-based apps)? Which are theoretical problems and which ones are problems with specific implementations? bonus question: do databases provide enough authorization? While doing my research, I came across the following discussion thread: http://archives.postgresql.org/message-id/4AE02DF0.40101@enterprisedb.com which pokes some holes into traditional view-based row access control in the PostgreSQL implementation.