title: Convert from Procedural to Object Oriented Code

text: I have been reading Working Effectively with Legacy Code and Clean Code with the goal of learning strategies on how to begin cleaning up the existing code- base of a large ASP.NET webforms application. This system has been around since 2005 and since then has undergone a number of enhancements. Originally the code was structured as follows (and is still largely structured this way):   * ASP.NET (aspx/ascx)    * Code-behind (c#)   * Business Logic Layer (c#)    * Data Access Layer (c#)    * Database (Oracle) The main issue is that the code is procedural masquerading as object-oriented. It virtually violates all of the guidelines described in both books. This is an example of a typical class in the Business Logic Layer:                   public class AddressBO     {         public TransferObject GetAddress(string addressID)         {             if (StringUtils.IsNull(addressID))             {                 throw new ValidationException("Address ID must be entered");             }                  AddressDAO addressDAO = new AddressDAO();             return addressDAO.GetAddress(addressID);         }              public TransferObject Insert(TransferObject addressDetails)         {             if (StringUtils.IsNull(addressDetails.GetString("EVENT_ID")) ||                 StringUtils.IsNull(addressDetails.GetString("LOCALITY")) ||                 StringUtils.IsNull(addressDetails.GetString("ADDRESS_TARGET")) ||                 StringUtils.IsNull(addressDetails.GetString("ADDRESS_TYPE_CODE")) ||                 StringUtils.IsNull(addressDetails.GetString("CREATED_BY")))             {                 throw new ValidationException(                     "You must enter an Event ID, Locality, Address Target, Address Type Code and Created By.");             }                  string addressID = Sequence.GetNextValue("ADDRESS_ID_SEQ");             addressDetails.SetValue("ADDRESS_ID", addressID);                  string syncID = Sequence.GetNextValue("SYNC_ID_SEQ");             addressDetails.SetValue("SYNC_ADDRESS_ID", syncID);                  TransferObject syncDetails = new TransferObject();                  Transaction transaction = new Transaction();                  try             {                 AddressDAO addressDAO = new AddressDAO();                 addressDAO.Insert(addressDetails, transaction);                      // insert the record for the target                 TransferObject addressTargetDetails = new TransferObject();                 switch (addressDetails.GetString("ADDRESS_TARGET"))                 {                     case "PARTY_ADDRESSES":                         {                             addressTargetDetails.SetValue("ADDRESS_ID", addressID);                             addressTargetDetails.SetValue("ADDRESS_TYPE_CODE",                                                           addressDetails.GetString("ADDRESS_TYPE_CODE"));                             addressTargetDetails.SetValue("PARTY_ID", addressDetails.GetString("PARTY_ID"));                             addressTargetDetails.SetValue("EVENT_ID", addressDetails.GetString("EVENT_ID"));                             addressTargetDetails.SetValue("CREATED_BY", addressDetails.GetString("CREATED_BY"));                                  addressDAO.InsertPartyAddress(addressTargetDetails, transaction);                                  break;                         }                     case "PARTY_CONTACT_ADDRESSES":                         {                             addressTargetDetails.SetValue("ADDRESS_ID", addressID);                             addressTargetDetails.SetValue("ADDRESS_TYPE_CODE",                                                           addressDetails.GetString("ADDRESS_TYPE_CODE"));                             addressTargetDetails.SetValue("PUBLIC_RELEASE_FLAG",                                                           addressDetails.GetString("PUBLIC_RELEASE_FLAG"));                             addressTargetDetails.SetValue("CONTACT_ID", addressDetails.GetString("CONTACT_ID"));                             addressTargetDetails.SetValue("EVENT_ID", addressDetails.GetString("EVENT_ID"));                             addressTargetDetails.SetValue("CREATED_BY", addressDetails.GetString("CREATED_BY"));                                  addressDAO.InsertContactAddress(addressTargetDetails, transaction);                                  break;                         }                          << many more cases here >>                     default:                         {                             break;                         }                 }                      // synchronise                 SynchronisationBO synchronisationBO = new SynchronisationBO();                 syncDetails = synchronisationBO.Synchronise("I", transaction,                                                             "ADDRESSES", addressDetails.GetString("ADDRESS_TARGET"),                                                             addressDetails, addressTargetDetails);                           // commit                 transaction.Commit();             }             catch (Exception)             {                 transaction.Rollback();                 throw;             }                  return new TransferObject("ADDRESS_ID", addressID, "SYNC_DETAILS", syncDetails);         }                   << many more methods are here >>          }      It has a lot of duplication, the class has a number of responsibilities, etc, etc - it is just generally 'un-clean' code. All of the code throughout the system is dependent on concrete implementations. This is an example of a typical class in the Data Access Layer:                   public class AddressDAO : GenericDAO     {         public static readonly string BASE_SQL_ADDRESSES =             "SELECT " +             "  a.address_id, " +             "  a.event_id, " +             "  a.flat_unit_type_code, " +             "  fut.description as flat_unit_description, " +             "  a.flat_unit_num, " +             "  a.floor_level_code, " +             "  fl.description as floor_level_description, " +             "  a.floor_level_num, " +             "  a.building_name, " +             "  a.lot_number, " +             "  a.street_number, " +             "  a.street_name, " +             "  a.street_type_code, " +             "  st.description as street_type_description, " +             "  a.street_suffix_code, " +             "  ss.description as street_suffix_description, " +             "  a.postal_delivery_type_code, " +             "  pdt.description as postal_delivery_description, " +             "  a.postal_delivery_num, " +             "  a.locality, " +             "  a.state_code, " +             "  s.description as state_description, " +             "  a.postcode, " +             "  a.country, " +             "  a.lock_num, " +             "  a.created_by, " +             "  TO_CHAR(a.created_datetime, '" + SQL_DATETIME_FORMAT + "') as created_datetime, " +             "  a.last_updated_by, " +             "  TO_CHAR(a.last_updated_datetime, '" + SQL_DATETIME_FORMAT + "') as last_updated_datetime, " +             "  a.sync_address_id, " +             "  a.lat," +             "  a.lon, " +             "  a.validation_confidence, " +             "  a.validation_quality, " +             "  a.validation_status " +             "FROM ADDRESSES a, FLAT_UNIT_TYPES fut, FLOOR_LEVELS fl, STREET_TYPES st, " +             "     STREET_SUFFIXES ss, POSTAL_DELIVERY_TYPES pdt, STATES s " +             "WHERE a.flat_unit_type_code = fut.flat_unit_type_code(+) " +             "AND   a.floor_level_code = fl.floor_level_code(+) " +             "AND   a.street_type_code = st.street_type_code(+) " +             "AND   a.street_suffix_code = ss.street_suffix_code(+) " +             "AND   a.postal_delivery_type_code = pdt.postal_delivery_type_code(+) " +             "AND   a.state_code = s.state_code(+) ";                   public TransferObject GetAddress(string addressID)         {             //Build the SELECT Statement             StringBuilder selectStatement = new StringBuilder(BASE_SQL_ADDRESSES);                  //Add WHERE condition             selectStatement.Append(" AND a.address_id = :addressID");                  ArrayList parameters = new ArrayList{DBUtils.CreateOracleParameter("addressID", OracleDbType.Decimal, addressID)};                  // Execute the SELECT statement             Query query = new Query();             DataSet results = query.Execute(selectStatement.ToString(), parameters);                  // Check if 0 or more than one rows returned             if (results.Tables[0].Rows.Count == 0)             {                 throw new NoDataFoundException();             }             if (results.Tables[0].Rows.Count > 1)             {                 throw new TooManyRowsException();             }                  // Return a TransferObject containing the values             return new TransferObject(results);         }                   public void Insert(TransferObject insertValues, Transaction transaction)         {             // Store Values             string addressID = insertValues.GetString("ADDRESS_ID");             string syncAddressID = insertValues.GetString("SYNC_ADDRESS_ID");             string eventID = insertValues.GetString("EVENT_ID");             string createdBy = insertValues.GetString("CREATED_BY");                  // postal delivery             string postalDeliveryTypeCode = insertValues.GetString("POSTAL_DELIVERY_TYPE_CODE");             string postalDeliveryNum = insertValues.GetString("POSTAL_DELIVERY_NUM");                  // unit/building             string flatUnitTypeCode = insertValues.GetString("FLAT_UNIT_TYPE_CODE");             string flatUnitNum = insertValues.GetString("FLAT_UNIT_NUM");             string floorLevelCode = insertValues.GetString("FLOOR_LEVEL_CODE");             string floorLevelNum = insertValues.GetString("FLOOR_LEVEL_NUM");             string buildingName = insertValues.GetString("BUILDING_NAME");                  // street             string lotNumber = insertValues.GetString("LOT_NUMBER");             string streetNumber = insertValues.GetString("STREET_NUMBER");             string streetName = insertValues.GetString("STREET_NAME");             string streetTypeCode = insertValues.GetString("STREET_TYPE_CODE");             string streetSuffixCode = insertValues.GetString("STREET_SUFFIX_CODE");                  // locality/state/postcode/country             string locality = insertValues.GetString("LOCALITY");             string stateCode = insertValues.GetString("STATE_CODE");             string postcode = insertValues.GetString("POSTCODE");             string country = insertValues.GetString("COUNTRY");                  // esms address             string esmsAddress = insertValues.GetString("ESMS_ADDRESS");                  //address/GPS             string lat = insertValues.GetString("LAT");             string lon = insertValues.GetString("LON");             string zoom = insertValues.GetString("ZOOM");                  //string validateDate = insertValues.GetString("VALIDATED_DATE");             string validatedBy = insertValues.GetString("VALIDATED_BY");             string confidence = insertValues.GetString("VALIDATION_CONFIDENCE");             string status = insertValues.GetString("VALIDATION_STATUS");             string quality = insertValues.GetString("VALIDATION_QUALITY");                       // the insert statement             StringBuilder insertStatement = new StringBuilder("INSERT INTO ADDRESSES (");             StringBuilder valuesStatement = new StringBuilder("VALUES (");                  ArrayList parameters = new ArrayList();                  // build the insert statement             insertStatement.Append("ADDRESS_ID, EVENT_ID, CREATED_BY, CREATED_DATETIME, LOCK_NUM ");             valuesStatement.Append(":addressID, :eventID, :createdBy, SYSDATE, 1 ");             parameters.Add(DBUtils.CreateOracleParameter("addressID", OracleDbType.Decimal, addressID));             parameters.Add(DBUtils.CreateOracleParameter("eventID", OracleDbType.Decimal, eventID));             parameters.Add(DBUtils.CreateOracleParameter("createdBy", OracleDbType.Varchar2, createdBy));                  // build the insert statement             if (!StringUtils.IsNull(syncAddressID))             {                 insertStatement.Append(", SYNC_ADDRESS_ID");                 valuesStatement.Append(", :syncAddressID");                 parameters.Add(DBUtils.CreateOracleParameter("syncAddressID", OracleDbType.Decimal, syncAddressID));             }                  if (!StringUtils.IsNull(postalDeliveryTypeCode))             {                 insertStatement.Append(", POSTAL_DELIVERY_TYPE_CODE");                 valuesStatement.Append(", :postalDeliveryTypeCode ");                 parameters.Add(DBUtils.CreateOracleParameter("postalDeliveryTypeCode", OracleDbType.Varchar2, postalDeliveryTypeCode));             }                  if (!StringUtils.IsNull(postalDeliveryNum))             {                 insertStatement.Append(", POSTAL_DELIVERY_NUM");                 valuesStatement.Append(", :postalDeliveryNum ");                 parameters.Add(DBUtils.CreateOracleParameter("postalDeliveryNum", OracleDbType.Varchar2, postalDeliveryNum));             }                  if (!StringUtils.IsNull(flatUnitTypeCode))             {                 insertStatement.Append(", FLAT_UNIT_TYPE_CODE");                 valuesStatement.Append(", :flatUnitTypeCode ");                 parameters.Add(DBUtils.CreateOracleParameter("flatUnitTypeCode", OracleDbType.Varchar2, flatUnitTypeCode));             }                  if (!StringUtils.IsNull(lat))             {                 insertStatement.Append(", LAT");                 valuesStatement.Append(", :lat ");                 parameters.Add(DBUtils.CreateOracleParameter("lat", OracleDbType.Decimal, lat));             }                  if (!StringUtils.IsNull(lon))             {                 insertStatement.Append(", LON");                 valuesStatement.Append(", :lon ");                 parameters.Add(DBUtils.CreateOracleParameter("lon", OracleDbType.Decimal, lon));             }                  if (!StringUtils.IsNull(zoom))             {                 insertStatement.Append(", ZOOM");                 valuesStatement.Append(", :zoom ");                 parameters.Add(DBUtils.CreateOracleParameter("zoom", OracleDbType.Decimal, zoom));             }                  if (!StringUtils.IsNull(flatUnitNum))             {                 insertStatement.Append(", FLAT_UNIT_NUM");                 valuesStatement.Append(", :flatUnitNum ");                 parameters.Add(DBUtils.CreateOracleParameter("flatUnitNum", OracleDbType.Varchar2, flatUnitNum));             }                  if (!StringUtils.IsNull(floorLevelCode))             {                 insertStatement.Append(", FLOOR_LEVEL_CODE");                 valuesStatement.Append(", :floorLevelCode ");                 parameters.Add(DBUtils.CreateOracleParameter("floorLevelCode", OracleDbType.Varchar2, floorLevelCode));             }                  if (!StringUtils.IsNull(floorLevelNum))             {                 insertStatement.Append(", FLOOR_LEVEL_NUM");                 valuesStatement.Append(", :floorLevelNum ");                 parameters.Add(DBUtils.CreateOracleParameter("floorLevelNum", OracleDbType.Varchar2, floorLevelNum));             }                  if (!StringUtils.IsNull(buildingName))             {                 insertStatement.Append(", BUILDING_NAME");                 valuesStatement.Append(", :buildingName ");                 parameters.Add(DBUtils.CreateOracleParameter("buildingName", OracleDbType.Varchar2, buildingName));             }                  if (!StringUtils.IsNull(lotNumber))             {                 insertStatement.Append(", LOT_NUMBER");                 valuesStatement.Append(", :lotNumber ");                 parameters.Add(DBUtils.CreateOracleParameter("lotNumber", OracleDbType.Varchar2, lotNumber));             }                  if (!StringUtils.IsNull(streetNumber))             {                 insertStatement.Append(", STREET_NUMBER");                 valuesStatement.Append(", :streetNumber ");                 parameters.Add(DBUtils.CreateOracleParameter("streetNumber", OracleDbType.Varchar2, streetNumber));             }                  if (!StringUtils.IsNull(streetName))             {                 insertStatement.Append(", STREET_NAME");                 valuesStatement.Append(", :streetName ");                 parameters.Add(DBUtils.CreateOracleParameter("streetName", OracleDbType.Varchar2, streetName));             }                  if (!StringUtils.IsNull(streetTypeCode))             {                 insertStatement.Append(", STREET_TYPE_CODE");                 valuesStatement.Append(", :streetTypeCode ");                 parameters.Add(DBUtils.CreateOracleParameter("streetTypeCode", OracleDbType.Varchar2, streetTypeCode));             }                  if (!StringUtils.IsNull(streetSuffixCode))             {                 insertStatement.Append(", STREET_SUFFIX_CODE");                 valuesStatement.Append(", :streetSuffixCode ");                 parameters.Add(DBUtils.CreateOracleParameter("streetSuffixCode", OracleDbType.Varchar2, streetSuffixCode));             }                  if (!StringUtils.IsNull(locality))             {                 insertStatement.Append(", LOCALITY");                 valuesStatement.Append(", :locality");                 parameters.Add(DBUtils.CreateOracleParameter("locality", OracleDbType.Varchar2, locality));             }                  if (!StringUtils.IsNull(stateCode))             {                 insertStatement.Append(", STATE_CODE");                 valuesStatement.Append(", :stateCode");                 parameters.Add(DBUtils.CreateOracleParameter("stateCode", OracleDbType.Varchar2, stateCode));             }                  if (!StringUtils.IsNull(postcode))             {                 insertStatement.Append(", POSTCODE");                 valuesStatement.Append(", :postcode ");                 parameters.Add(DBUtils.CreateOracleParameter("postcode", OracleDbType.Varchar2, postcode));             }                  if (!StringUtils.IsNull(country))             {                 insertStatement.Append(", COUNTRY");                 valuesStatement.Append(", :country ");                 parameters.Add(DBUtils.CreateOracleParameter("country", OracleDbType.Varchar2, country));             }                  if (!StringUtils.IsNull(esmsAddress))             {                 insertStatement.Append(", ESMS_ADDRESS");                 valuesStatement.Append(", :esmsAddress ");                 parameters.Add(DBUtils.CreateOracleParameter("esmsAddress", OracleDbType.Varchar2, esmsAddress));             }                  if (!StringUtils.IsNull(validatedBy))             {                 insertStatement.Append(", VALIDATED_DATE");                 valuesStatement.Append(", SYSDATE ");                 insertStatement.Append(", VALIDATED_BY");                 valuesStatement.Append(", :validatedBy ");                 parameters.Add(DBUtils.CreateOracleParameter("validatedBy", OracleDbType.Varchar2, validatedBy));             }                       if (!StringUtils.IsNull(confidence))             {                 insertStatement.Append(", VALIDATION_CONFIDENCE");                 valuesStatement.Append(", :confidence ");                 parameters.Add(DBUtils.CreateOracleParameter("confidence", OracleDbType.Decimal, confidence));             }                  if (!StringUtils.IsNull(status))             {                 insertStatement.Append(", VALIDATION_STATUS");                 valuesStatement.Append(", :status ");                 parameters.Add(DBUtils.CreateOracleParameter("status", OracleDbType.Varchar2, status));             }                  if (!StringUtils.IsNull(quality))             {                 insertStatement.Append(", VALIDATION_QUALITY");                 valuesStatement.Append(", :quality ");                 parameters.Add(DBUtils.CreateOracleParameter("quality", OracleDbType.Decimal, quality));             }                  // finish off the statement             insertStatement.Append(") ");             valuesStatement.Append(")");                  // build the insert statement             string sql = insertStatement + valuesStatement.ToString();                  // Execute the INSERT Statement             Dml dmlDAO = new Dml();             int rowsAffected = dmlDAO.Execute(sql, transaction, parameters);                  if (rowsAffected == 0)             {                 throw new NoRowsAffectedException();             }         }              << many more methods go here >>     }      This system was developed by me and a small team back in 2005 after a 1 week .NET course. Before than my experience was in client-server applications. Over the past 5 years I've come to recognise the benefits of automated unit testing, automated integration testing and automated acceptance testing (using Selenium or equivalent) but the current code-base seems impossible to introduce these concepts. We are now starting to work on a major enhancement project with tight time- frames. The team consists of 5 .NET developers - 2 developers with a few years of .NET experience and 3 others with little or no .NET experience. None of the team (including myself) has experience in using .NET unit testing or mocking frameworks. What strategy would you use to make this code cleaner, more object-oriented, testable and maintainable?


title: Object Oriented programming on 8-bit MCU Case Study

text: I see that there's a lot of questions related to OO Programming here. I'm actually trying to find a specific resource related to embedded OO approaches for an 8 bit MCU. Several years back (maybe 6) I was looking for material related to Object Oriented programming for resource constrained 8051 microprocessors. I found an article/website with a case history of a design group that used a very small RAM part, and implemented many Object based constructs during their C design and development. I believe it was an 8051. The project was a success, and managed to stay inside the very small ROM/RAM they had available. I'm attempting to find it again, but Google can't locate it. The article was well written, and recommended a "mixed" approach using C methods for inheritance and encapsulation - if I recall correctly. Can anyone help me locate this article?


title: What is the term for a 'decoy' feature or intentional bug?

text: I have forgotten a slang programming term. This thing is an intentional bug or a decoy feature used as a distraction. An example usage, "Hey Bob, QA is doing a review today. Put a `$THING` into the module so they actually have a problem to find". This can be used negatively, to have a very obvious intentional flaw to discover as a distraction from a real problem. This can also be used positively. Its like how you always let rescue dogs 'find' a victim when searching a disaster area. It can also be used to verify that a QA process is actually catching flaws. What is the term I am looking for?


title: Returning null or a empty value/throw exception?

text: Various programming books suggest that methods should not return `null` values (Clean Code for example). Instead of returning `null` default values (0 or empty string or empty object) should be returned or an exception should be thrown. This is recommended in order to avoid many `!= null` checks or to avoid `NullPointerException`. I really don't understand how this helps. If you return a default value you have to make `!= DEFAULT` checks; more over, the default value might mean something (like 0 for a credit amount). Throwing a specific exception is not worth with, because if you don't handle your code well, an exception is thrown anyway - `NullPointerException`. I've thought about this when I found a bug caused by a method which returned an empty object (e.g. `new MyBean()`) instead of returning `null`. The code didn't worked functionally and the logs didn't warn anything, so detection and fixing was not that easy; with `null` a `NullPointerException` would have been thrown so spotting and fixing the bug would have been trivial. The only case where it makes sense to me to return a default value instead of returning `null` is when returning arrays/collections; here they are usually consumed `for each element in collection` so if its empty nothing happens but if it's `null` NPE is thrown.


title: What are the legal risks if any of using a GPL or AGPL Web Application Framework/CMS?

text: Tried to ask this on SO but was referred here... Am I correct in saying that using a GPL'ed web application framework such as Composite C1 would NOT obligate a company to share the source code we write against said framework? That is the purpose of the AGPL, am I correct? Does this also apply to Javascript frameworks like KendoUI? The GPL would require any changes that we make to the framework be made available to others if we were to offer it for download. In other words, merely loading a web sites content into my browser is not "conveying" or "distributing" that software. I have been arguing that we should avoid GPL web frameworks and now after researching I am pretty sure I am wrong but wanted to get other opinions? Seth


title: Including a GPL-license library in a commercial Java program

text: I am in the process of helping develop a commercial Java program. We want to use a certain third-party LookAndFeel in the GUI. The problem is that the LookAndFeel library is GPL licensed. Since we are planning to sell our product, would it be legal to use that GPL LookAndFeel in our product? The LookAndFeel in question is the InfoNode Look And Feel


title: Where is the 'this' variable stored?

text: Let's take this simple c++ program as an example:               #include <vector>     class A     {       void fun() { a = this + 1; }       A* a;     };          main()     {       std::vector<A> vec;       vec.resize(100);     }      Forgetting for the moment that `this` is a pointer to some instantiation of `A`, this question is about the variable `this` itself, and where its contents (the value of the memory address) is stored. It can't be a literal because the compiler can't know the location of class `A`, so its contents must be allocated _somewhere_ on the stack or heap as a variable. In this case the instances of `A` are allocated on the heap; does this mean the `this` pointer is also on the heap? Looking at the `resize` call of `vec`, a compiler might do something like this under the hood:               std::vector<A>::resize(this, 100); // where 'this' is a pointer to vec      So my question is, where does the `this` pointer come from? Ie. where is the contents of `this` (the 32/64-bit memory address value) stored in memory for it to be passed to this method? I would presume it can't be a normal member; so my first thought was that it's a mangled global variable of some sort, but then by storing an unknown number of them in a vector I don't see how the compiler could achieve this either. Where is the contentx of the `this` variable stored in relation to the contents of the `A` class member to which it refers? If the standard has something to say about this, I would prefer an answer with reference to the standard. Note that the reason I want to know is because I am concerned about false sharing of the memory allocated for the `this` object if I modify member variables. Knowledge of where the `this` object is stored might affect padding decisions.


title: Dynamic choice of compilers?

text: An application has the following logic:   * client => created *.cpp => sent to the server => cl.exe + *.cpp =   *.exe   * client => created *.cs => sent to the server => csc.exe + *.cs =   *.exe   * client => created *.pas => sent to the server => PascalCompiler +   *.pas = *.exe   * etc. The language - C#. I hear that MSBUILD can help me, but I don't understand how to change compiler on server at runtime. Does anyone know of options other than Process class? I'm trying to write an online system to test programs in programming contests. The programmer selects the compiler and sends the source code to the server for verification. And I do not need to build the project, I just need to compile a single file.


title: Distributed application using RabbitMQ

text: I am on my way to create an application with 4 bounded context using CQRS & event sourcing. In order to make these bounded context talk to each other I was planning on using Rabbit MQ. My requisites are the following :   * The bounded context must not know about each other   * The bounded context must not be hindered if the other bounded context are down or if rabbitMQ is down   * If a bounded context is not available the messages, that it should receive, must wait patiently for its return ie : every event published must be forwarded at least once to all the bc interested. Therefore, I was thinking about having each of them referencing a queue : BandMasterQueue and creates it if it is not. When producing an event, the event store stores it and its dispatch consists of two steps :   1. project on itself this event to every little projection. Each projection has a little tiny store of events already projected to warrant idempotency over some period of time.   2. publish this event to the queue BandMasterQueue if it would fail on step 2 because of no rabbitmq available, then I expect my event store to try again to dispatch the message to the RabbitMQ after sometime (not really though precisely about this part, I must say...) The bandMaster "bounded context" knows about every different BCs he looks after. He is the one reading the bandMasterQueue and decides which events are public and which are not. He is also responsible to handle the "sagas" and can send corrective actions to each bc. In order to do that, he will comunicate with each bounded context using the dedicated queue of the bounded context and creates it if it does not exits. Each BC is bound to this specific queue, and add the event coming from outside in its own event store, and afterwards project it to its own projection. Should this "architecture" work or do you see any major flaw in it?


title: Property-level value transformation for indirect object casting

text: Does any programming language exist to support the explicit, property-level object copy? For example, assume this code:               public class Student     {         public string Name { get; set; }              public string Code { get; set; }              public List<string> Interests { get; set; }     }          public class Item     {         public string Name { get; set; }               public string Code { get; set; }     }      I wonder if there is a compiler (or a language) out there that can indirectly cast two objects to each other, based on property-level matching and a lossy transformation algorithm?   1. Create an instance of the target class   2. Using reflection, find all properties of the target class   3. For each property, try to find a match in the source class, using name and type   4. If found, transfer the value   5. Otherwise, initialize to the default value Of course, this should be done **explicitly** with the full intention of the developer. For example, a C# pseudo-syntax might look like:               Student student = new Student();     student.Name = "Saeed";     student.Code = "513223";     Item item = copy student; // assume "copy" to be a keyword     // Here, item's name is "Saeed" and its code is "513223"


title: SEO for AJAX based website

text: My question is that we have a completely ajax based website: http://news.swalif.com/. Now we want to get all the 'pages' crawled by Google and other search engines, but we do not want to move to a PHP based solution or make an archive. I would like to get any ideas on how it could be possible.


title: Time limit on user input

text: I am trying to put a time limit on the user input, so if they take longer than 2 seconds to put type in an input then the program will terminate. I was wondering if there is a simple way to do this in C language?


title: Unit Tests code duplication?

text: How can I avoid code duplication in unit tests? Using Java and JUnit suppose I have something like this:               public interface Arithmetic<T> {         public T add(T a, T b);         public T sub(T a, T b);     }          public void IntegerArithmetic<Integer> {         //     }          public void DoubleArithmetic<Double> {         //     }      And the test class:               public class TestArith {          private Arithmetic<Integer> arith;          @Before     public void init() {         Arithmetic<Integer> arith = new IntegerArithmetic();         Integer term1 = 4;         Integer term2 = 3;     }          @Test     public void testAdd() {          assertEquals(7, arith.add(term1, term2));     }          @Test     public void testAdd() {          assertEquals(1, arith.sub(term1, term2));     }     }      The problem is that the test class for the DoubleArithmetic class should look exactly the same; the only difference is in @Before init() where the initialization of the concrete type is done. How can this code duplication be avoided?


title: Which is simpler for REST client call to return JSON - JQuery/JavaScript or Spring RestTemplate?

text: I've been trying to hack up an annotated Spring MVC web app but it's proving pretty hard to call a URL of my web app which fires a request to a remote API (UK Police data) and recieves a reply which I can then return as JSON. I've been trying to use Spring's RestTemplate. The odd JavaScript example that I've glanced at does seem to be suited to that task a lot better and more simplistic than a full blown servlet. **Is that an opinion that you also share and can back up with a good, clear simple example?** JavaScript does seem to provide a good platform for this kind of task **Or, in other words, is it simpler to create a "web-app" with JavaScript that does some REST calls and renders the response than trying to do it with Spring?**


title: What do you need to do when mentoring a new graduate?

text: Well I have been THE junior developer in a small team for several years. Now, there is a new fresh graduate so I have become the not-so-junior-developer and have been asked to mentor him. But I have no idea what to do since I have always been kind of a "figure- things-out-on-my-own" person and didn't receive much mentoring. So, what do you need to do when mentoring a new graduate?


title: How stable is Common LISP as a language?

text: I have been reading a bit about Common Lisp and I am considering trying to learn it (I only know very basic concepts) or even using it for some project. Question: how stable is Common Lisp as a language? What I mean is, regardless of new libraries, are new language features (involving new syntax and semantics) being added to the language? In other words, if I learn Common Lisp now, would I be able to use the same language in 10 years from now, or read code that was written 10, 20 years ago (apart, of course, from having to get familiar with different libraries and API's)?


title: Inheriting from Abstract class vs Enum Types for custom exceptions

text: I am creating an interface and would like the implementer(s) of this interface to throw exceptions in the case that something goes wrong. Let's call the implementer a plugin. I have a director which can call any one of the plugins. Rather than each plugin throwing it's own random exception, I would like plugins to throw specific exceptions which my director can then handle. For example: If the plugins fail to authenticate with the credentials that are provided by the director or if the requested action times out on the plugin, the plugin should throw an exception. Rather than each plugin throw it's own random exception, I would like plugins to throw specific exceptions that the director knows about and can handle. I do this because if an exception is fatal (like authentication failed) I don't want to retry, whereas if it was a timeout, the director may decide to retry. Now, I am confused as to which of the following ways is better: **Idea 1:** Create a custom exception (lets say `PluginException`) and have an enum type which different types of exception (such as `authenticationfailed`, `timeoutout`, `permissiondenied`, etc.) The director will catch all `PluginException`s and handle each exception case by case. **Idea 2:** Create an abstract exception (lets say `PluginException` again) and have specific exception types derive from my abstract exception (like `AuthenticationFailedException`, `TimeoutException`, etc.) The director can listen for any specific exception it is interested in and also listen for the broader `PluginException` if none of the above exception types match the exception thrown by the plugins.


title: Detect duplicate in a subset from a set of elements

text: I have a set of numbers say : 1 1 2 8 5 6 6 7 8 8 4 2... I want to detect the duplicate element in subsets(of given size say k) of the above numbers... For example : Consider the increasing subsets(for example consider k=3) Subset 1 :{1,1,2} Subset 2 :{1,2,8} Subset 3 :{2,8,5} Subset 4 :{8,5,6} Subset 5 :{5,6,6} Subset 6 :{6,6,7} .... .... So my algorithm should detect that subset 1,5,6 contains duplicates.. My approach : 1)Copy the 1st k elements to a temporary array(vector) 2) using #include file in C++ STL...using unique() I would determine if there's any change in size of vector.. Any other clue how to approach this problem..


title: Date calculation algorithm

text: I'm working on a project to schedule a machine shop, basically I've got everything covered BUT date calculations, I've got a method called schedule (working on PHP here):               public function schedule($start_date, $duration_in_minutes)      Now my problem is, currently I'm calculating end time manually because time calculations have the following rules:   1. During weekdays, work with business hours (7:00 AM to 5:00 PM)   2. Work on Saturdays from 7:00 AM to 2:00 PM   3. Ignore holidays (in Colombia we have A LOT of holidays) I already have a lookup table for holidays, I also have a Java version of this algorithm that I wrote for a previous version of the project, but that one's also manual. Is there any way to calculate an end time from a start time given duration?, my problem is that I have to consider the above rules, I'm looking for a (maybe?) math based solution, however I currently don't have the mind to devise such a solution myself. I'll be happy to provide code samples if necessary.


title: Why are people laughing at visual basic?

text: When I was at high school I used visual basic 6 and I think it was pretty good. Then I came to the university and began to use c/c++ java python etc.. I didn't find a reason why people laugh at visual basic, is it because of its syntax? or something else? **UPDATE:** all of you have gave fantastic answers, but tdammers's answer is what I'm wondering at first. Thanks a lot for all your help:)


title: TDD, BDD or both?

text: I'm a little bit confused about BDD. I'm doing TDD currently. My question is whether BDD is complementary to TDD or it's a whole new thing and my team should do both TDD and BDD? Or is it enough to do just one or the other?


title: What is the difference between BDD and TDD?

text: I have been learning writing test cases for BDD using specflow. If I write comprehensive tests with BDD is it necessary to write TDD test separately? Is it necessary to write test cases for both TDD and BDD separately? It seems to me that both are same, the only difference being that BDD can be understood by non developers and testers.


title: Is the difference between BDD and TDD nothing more than a vocabulary shift?

text: I recently made a start on learning BDD (Behaviour Driven Development) after watching a Google tech talk presented by David Astels. He made a very interesting case for using BDD and some of the literature I've read seem to highlight that it's easier to sell BDD to management. Admittedly, I'm a little skeptical about BDD after watching the above video. So, I'm interested to understand if BDD is indeed nothing more than a change in vocabulary or if it offers other benefits.


title: Relation between BDD and TDD

text: What is the relation of BDD and TDD? From what I understood BDD adds two main things over TDD: tests naming (ensure/should) and acceptance tests. Should I follow TDD during development by BDD? If yes, should my TDD unit tests be named in the same ensure/should style?


title: Returning a mock object from a mock object

text: I'm trying to return an object when mocking a parser class. This is the test code using PHPUnit 3.7                   //set up the result object that I want to be returned from the call to parse method         $parserResult= new ParserResult();         $parserResult->setSegment('some string');                      //set up the stub Parser object         $stubParser=$this->getMock('Parser');         $stubParser->expects($this->any())                    ->method('parse')                    ->will($this->returnValue($parserResult));              //injecting the stub to my client class         $fileWriter= new FileWriter($stubParser);         $output=$fileWriter->writeStringToFile();      Inside my `writeStringToFile()` method I'm using `$parserResult` like this:               writeStringToFile(){        //Some code...         $parserResult=$parser->parse();         $segment=$parserResult->getSegment();//that's why I set the segment in the test.     }      Should I mock `ParserResult` in the first place, so that the mock returns a mock? Is it good design for mocks to return mocks? Is there a better approach to do this all?!


title: Help to understand the abstract factory pattern

text: I'm learning the 23 design patterns of the GoF. I think I've found a way to understand and simplify how the Abstract Factory works but I would like to know if this is a correct assumption or if I am wrong. What I want to know is if we can see the result of the Abstract Factory method as a matrix of possible products where there's a Product for every "Concrete Factory" x "AbstractProduct" where the Concrete Factory is a single implementation among the implementations of an AbstractFactory and an AbstractProduct is an interface among the interfaces to create Products. Is this correct or am I missing something?


title: What are the differences between Special Edition and the Third Edition of Stroustrup's The C++ Programming Language?

text: I'm buying a few C++ books after moving from Java. I obviously want to read the reference manual from the man himself, though I cannot tell the difference between these two editions. The special edition is ten pages shorter than the third edition. However, the special edition is recommended over the third edition and it seems this version covers the ISO standard when the other edition does not. Can anyone shed a bit of light on this?


title: Can we create desktop application with Ruby?

text: I know the Ruby on Rails framework is only for web development and not suitable for desktop application development. But if a ruby programmer wants to develop a desktop application, is it suitable and preferable to do it with Ruby only (not jRuby, as most of the tutorials are for jRuby)? If yes, please provide some good tutorials. I want to use linux as OS for development. Please suggest something, as I am a ruby developer and wants to develop desktop application.


title: How quickly does the Java language get outdated?

text: I started learning Java recently. I started learning it using books that I picked up from the library, some that I bought, and here and there from Java documentation.   The book that I use for Java was published in the year 2011. In 2012, Java8 will be released followed by Java9 in the year 2013.   The questions are:   * How do I keep myself updated about developments in Java without having to buy a tome for Java8 and/or Java9   * Is a book published in 2008 an outdated book for studying JSP and Servelets? I'm talking about Head First Servlets and JSP


title: What does it mean to "expose" something?

text: So I am working on creating a Google App Engine Application, and I've come across the term "expose" a number of times, e.g. "your first app can expose objects using an HTTP based API" and "expose this datamodel class through a REST API". What does "expose" mean? Is there a particular action associated it, or is it an abstract part of design?


title: Need thoughts on a course curriculum for an entry-level programmer

text: Would love to know your thoughts on a curriculum that will be developed for people that want to get started in the programming field. The goal of the course is to help it's students to ensure that students have an understanding of the theory and skills required to be a programmer, and have enough skills to get entry-level jobs upon graduation. Curriculum is:   * 400 hours of instruction plus self-study.   * 40 hours of practicum **1\. Foundation** a. Clarity b. Detail orientation c. Communication d. Compartmentalization/abstraction e. Typing f. Memory **2\. Theory** a. Lexical analysis b. Parsing c. Optimization d. Hierarchical thinking e. Scope f. Type systems **3\. Computer Science** a. Data structure (ex. sorting, searching, data structure transversal) b. Recursion c. Language structures (ex. arrays, linked lists, dictionaries, etc) **4\. Systems Architecture** **5\. Operating System Theory** a. POSIX b. IO c. Memory allocation **6\. Object Oriented Programming** a. Java b. PL/SQL * * * Would love to know:   1. Is the above curriculum laid out clearly? If not, how would it be best to change it?   2. Are there any crucial components being missed from the above outline?   3. Should any components be removed from the above outline (considering the timeline)? Perhaps it's too detailed at certain points and is not in balance with the rest of the content?


title: Is using SVN for development and CM a bad practice?

text: I have a bit of experience with SVN as a pure programmer/developer. Within my company, however, we use SVN as our Configuration Management (CM) tool. I thought using SVN for development at the same time was OK since we could use branches and the trunk for dev, and tags for releases. To me, the tags were the CM part, and the branches/trunk were the dev part. Recently a person, who develops high level code (but outside of the "pure SW" group) mentioned that the existing philosophy (mixing SVN for dev and CM) was wrong... in his opinion. His reasoning is that he thinks the company's CM tool should always link to run-able SW (so branches would break this rule). He also mentioned that a CM tool shouldn't be a backup utility for daily or incremental commits. Finally, he doesn't like the idea of having to jump from revision 143 to 89 in order to get a working copy... and further that CM tools shouldn't allow reversion to a broken state. In general he wants to separate the CM and back-up/dev utilties that SVN offers. Honestly, I am new and the person with this perspective is one of seniority, experience, and success, so I want to field this dilemma with the stackoverflow userbase to see if his approach has merit. My question: Should SVN be purely used for development, and another tool for CM (or vice versa)? Why? If so, what tools would you suggest for this combo? Or do you think that integrating both CM and dev into SVN is the best approach? Why? Thanks. * * * **Edit-** during my research I found the following site which may give some more reasons against using SVN for CM. Are the author's points valid? I feel like this is aligned with what my colleague was inferring... Link: SVN isn't CM


title: Different ways of solving problems in code

text: I now program in C# for a living but before that I programmed in python for 5 years. I have found that I write C# very differently than most examples I see on the web. Rather then writing things like:               foreach (string bar in foo)     {         //bar has something doen to it here     }      I write code that looks like this.               foo.ForEach( c => c.someActionhere() )      Or               var result = foo.Select( c =>                     {                         //Some code here to transform the item.                     }).ToList();      I think my using code like above came from my love of map and reduce in python - while not exactly the same thing, the concepts are close. Now it's time for my question. What concepts do you take and move with you from language to language; that allow you to solve a problem in a way that is not the normal accepted solution in that language?


title: Transitioning from Oracle based CMS to MySQL based CMS

text: We're looking at a replacement for our CMS which runs on Oracle. The new CMSes that we've looked at can in theory run on Oracle, but   * most of the vendor's installs run off of MySQL   * vendor supports install of their CMS on MySQL, and a "theoretical" install on Oracle   * the vendor's dev shops use MySQL   * none of them develop/test against Oracle Our DBA team works exclusively with Oracle, and doesn't have the bandwidth to provide additional support for a highly available and performing MySQL setup. They could in theory go to training and get ramped up, but our time line is also short (surprise!). So ... I guess my question(s) are: If you've seen a situation like this, how have you dealt with it? What tipped the balance either way? What type of effort did it take? If you're to do it over, what would you do differently ... ? Thanks! KM


title: How important is positive feedback in code reviews?

text: Is it important to point out the **good** parts of the code during a code review and the reasons why it is good? Positive feedback might be just as useful for the developer being reviewed and for the others that participate in the review. We are doing reviews using an online tool, so developers can open reviews for their committed code and others can review their code within a given time period (e.g. 1 week). Others can comment on the code or other reviewer's comments. Should there be a balance between positive and negative feedback?


title: Where to put format validation in a CQRS “stylish” domain model?

text: It feels right to put format validation inside the domain objects (VOs or entities) because it is the natural place for high cohesion and the domain knows best what every domain description/attribute/property means. Many DDD practitioners and books authors (Vaugh Vernon, Dan Bergh - and even Eric Evans suggest , but on a different aspect: authorization, to model the domain to reflect these matters) sugest to design the domain model in a way to reflect and enforce a proper state of the business. I agree that format validation (ie.: address property in EmailAddress VO should be max ~250 chars and should match a regex) should be implemented inside the domain objects. But these validation checks work best with a domain model that will be used for both state changes and state queries. What about CQRS where the command side (where the domain model is) has little or no knowledge about the read side. Should one reimplement the same input format checks in the query side of the application? In CQRS there are some common responsibilities for both command and query side (like input format validation), so the usual format validation implementations that most of DDD practitioners sugest will be duplicated. How should one deal with this, w/o making the domain model (from the command side) to be anemic and w/o making unaware of the state of the attributes it will hold . An example : there might be a feature that would let a conference owner to schedule a conference and change the number of available seats. But because the conference room is not big enough, the maximum allowed number of seats would be 100. So a business rule would be that : a conference owner cannot add more than 100 seats for a scheduled conference (also minimum 1 seat needed for the conference to be in a valid state). So a method would be on a ConferenceAR :               changeNumberOfAvailableSeats(numberOfAvailableSeats) {         if(!isNumber(numberOfAvailableSeats) || numberOfAvailableSeats > 100 ||                    numberOfAvailableSeats < 1) {             throw new DomainException ...         }                // Change the number of available seats ...     }      On the query side there might be an UI page where you can find all the scheduled conferences that have a certain number of available seats. So again , on the server's query side of the application, there must be a format validation that will check if the query for scheduled conferences with a number of seats available is a number and is in the range 1-100. This query might be needed by someone who wants to reserve a certain number of seats for a conference . Also conferences might be on the same topic so one could see a confenrece with the same topic many times and choose the one cheaper or with more seats available. So again, should one reimplement the format validation on both query and command sides or there is another solution? P.S. : there are many format validation duplicates (on both command and query side) like the email format validation , or a currency format validation (if the currency is : USD || CAD || AUD etc ...) **P.P.S. : Another question that poped up : Does the query side of the application reuquire any input format validation ? If the input is not a valid format it will return nothing , query found no data related to the request. I see that format validation on the query side is purely a security measure (ie. for buffer overflows). So is the input format validation really required on the query side ?**


title: How to make a PHP function triggered automatically at a user defined time

text: I am developing an internal system for a company with PHP using Zend framework. I need one of its functions to execute on a time specified by user. My research on this matter found me several ways of doing this using CPanel Cron jobs and setting up scheduled tasks on the server. But in this scenario, I don't have a CPanel and I already use scheduled tasks. But my challenge is to provide an interface for the user to specify the time to trigger the function.


title: How do I convince my teammates that we should not ignore compiler warnings?

text: I work on a huge project (more like a tangled up combination of dozens of mini projects that can't be easily separated due to poor dependency management, but that's a different discussion) in Java using eclipse. We've already turned off a number of warnings from compiler settings and the project still has over 10,000 warnings. I'm a big proponent for trying to address all warnings, fix all of them if possible, and for those that are looked into and deemed safe, suppress them. (Same goes for my religious obsession with marking all implemented/overriden method as @Override). My biggest argument is that generally warnings help you find potential bugs during compile time. Maybe out 99 of 100 times, the warnings are insignificant, but I think the head scratching that it saves for the one time that it prevents a major bug, it's all worth it. (My other reason is my apparent OCD with code cleanness). However, a lot of my teammates don't seem to care. I occasionally fix warnings when I stumble across them (but you know it's tricky when you touch code written by a co-worker). Now with literally more warnings than classes, the advantages of warnings are very much minimized, because when warnings are so common-place, nobody will bother looking into all of them. How can I convince my teammates (or the powers that be) that warnings need to be addressed (or suppressed when fully investigated)? Or should I convince myself that I'm crazy? Thanks (P.S. I forgot to mention what finally prompted me to post this question is that I sadly noticed that I'm fixing warnings slower than they are produced)


title: Controllers in CodeIgniter

text: I little bit new to the CodeIgniter framework and this is my first project with this framework. During a chat on StackOverflow somebody said that we need to make controllers tiny as possible. Currently I have a default controller named `home` with 1332 lines of codes (and increasing) and a model named `Profunction` with 1356 lines of codes (and increasing). The controller class have about 46 functions on it and also with model class. I thought that Codeigniter can handle large Controllers or Models well, is there any problem/performance issue/security issues regarding this?


title: How do regular expressions actually work?

text: Say you have a document with an essay written. You want to parse this essay to only select certain words. Cool. Is using a regular expression faster than parsing the file line by line and word by word looking for a match? If so, how does it work? How can you go faster than looking at each word?


title: How does a programmer tell a business analyst that she isn't right?

text: I implemented some functionality, then a business analyst created a defect, saying that some message text is wrong. Then I reviewed the spec again and found that I'm right. I posted a spec excerpt and closed the defect. Then she reopened the defect again, saying that there was a mistake in the spec and that I shouldn't implement it mindlessly and should escalate this particular thing to her. How should I respond?


title: Interview question: which is the time period estimated by you to learn Java

text: At my last interview(it was a phone interview) I was asked: "Which is the time period in which you can learn Java?". I've answered that I believe that in 2-3 month I'm able to write good code for non-fancy/regular applications. After that I observed that the employer took a long break and switched to other questions. Now, I'm asking you, what you've answered if you were in my place. PS: I didn't worked a lot with Java(2 weeks), so I don't think that a person who is saying something like "I can learn Java in 2 days" is fair with him/herself.


title: Tester-Developer communication

text: While a lot is written about developer-developer, developer-client, developer- team manager communications, I couldn't find any text which gives guidelines about tester-developer communication and relation. Whether testers and developers are separate teams or in the same one (in my case, I am a lone tester in an agile development project), I have the belief that how testers are perceived is extremely important in order for testing to be well-accepted, and to serve its goal in enhancing the quality of the project (for example, they should not be viewed as a police force). Any advices, or studies about how a tester should communicate with developers? **Update** : Thank you all for your answers. They all confirmed what I had in mind. As for now, my team was very receptive of my role and we ended up making real progress. I could have chosen more than one as the answer but I had to make my decision.


title: Is seniority/paygrade an important factor for effective QA members?

text: As a member of our company's QA team, I frequently get entirely unenthusiastic feedback from developers in their responses to test results in our agile, web- based software-as-a-service shop. Most of our testing is manual, since automated testing doesn't really make sense for us right now, and developers are usually reluctant to listen to any change suggestions beyond those that prevent javascript/500 errors. I understand that fixes/changes require work, and our developers are rarely short on work to do, but I don't think developers respect QAs input. Unfortunately, our product owners are vacant: acceptance testing doesn't exist, and user stories usually are only one sentence long, and don't provide the developer with much to go off of. There is no other feedback mechanism to development other than from customers x-weeks later, who aren't designers/developers either, of course, and whose suggestions are all over the board. I am technically competent, at worse, and am capable of simple development on our LAMP stack and feel confident that developers respect my knowledge. However, I have for the most part given up on feedback beyond that which prevents critical errors--which affect data integrity, or bottom-line functionality. This has raised the question of whether seniority, or pay grade is a significant factor in how seriously developers value QAs input. In our case, where we don't do automated testing and QA members likely don't have as much technical expertise, it kind of makes sense that we make less than developers (between 60-70%, depending on time in grade). I don't believe in the argument that the opinion of the team member with the biggest pay check is the most important, however I can imagine how it's difficult to take feedback from team members who have a year or two less experience, are not as technically knowledgeable, and make noticeably less. In the end the best idea should win, but unfortunately that might be decided after the enhancement has been on production for several months, and users love it or hate it.


title: What are the advantages of Scala's companion objects vs static methods?

text: Scala has no _static_ -keyword, but instead has similar functionality through companion objects. Behind the scenes the companion objects are compiled to classes that have static methods, so all this is syntactic sugar. What are the advantages of this design choice? Disadvantages? Do other languanges have similar constructs?


title: Review tests first

text: I am going to adopt TDD in our team and one of the ideas I have is to review tests first. So one would write interfaces, mocks, and tests first, submit them for a code review and once interfaces and tests (think specification) are approved an actual implementation can be written (theoretically, can be done by another developer). I wonder how viable this idea is?


title: CoffeeScript translates to JavaScript. Is there something like it for C?

text: > **Possible Duplicate:**   >  Is there a language that transcompiles to C with a better syntax? There are many language implementations which compile to C. However, most of them have some language specific runtime requirement. For example, Gambit-C and Vala both compile to C. Gambit-C depends upon a garbage collector. Vala depends upon the GObject system. Are there languages which compile to C which have no dependencies beyond standard C libraries such as libc?


title: Readability of || statements

text: On HTML5 Boilerplate they use this code for jQuery:               <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>     <script>window.jQuery || document.write('<script src="js/libs/jquery-...      What's more readable:               if (!window.jQuery) document.write(...);      or               window.jQuery || document.write(...);


title: Write once, run anywhere. Is it still relevant?

text: Since Oracle bought Sun and Apple have decided not to continue developing their JVM, is the "write once and run everywhere" model still relevant or has web services/SOA reduced it to an edge case?


How valid is the statement "write once, debug everywhere" by some Java users? If it is true, what is the effect to us?


title: Best practices for web page styling with CSS?

text: I have a website to design. I have information on how the page should look and interact. The problem is I'm not good in front-end design, and have put many many hours to get the hang of the stuff. Currently I use the CSS from sample sites in github to style my site, which seems to be an un-ethical way. **Question:** how do you style webpages?   * Are there some really good tools?    * I would be deeply appreciated if a detailed answer will be provided or link to wiki will work as well.


title: Implementation of strategy design pattern

text: Here is my code:               public class StrategyDemo {                  public static void main(String[] args) {                      Phone ipPhone = new IPPhone("1234", "ProviderA");                 Phone tdmPhone = new TDMPhone("4567", "ProviderB");                      ipPhone.getRecordingResource();                 tdmPhone.getRecordingResource();                      ipPhone.setRecordingResource(Resource.IPRecorderIP2);                        ipPhone.getRecordingResource();                  }              }      ![enter image description here](http://i.stack.imgur.com/SX1HE.gif) As I understood, a strategy pattern made that I would be able to change dynamically objects. I always have hard time to actuality think of something to implement to practice on them. This implementation is actually a strategy implementation ? How should I improve it? * * * Regarding comments asking to clarify my needs, I will try to explain the problem that I created that it will be more clear to determine if I used strategy correctly. A phone should have an ability to be recorded. A phone can be one of 2 types - `IPPhone` or `TDMPhone`.   A recording resource can be one of 2 types - TDMRecorder or IPRecorder. IPRecorder should but not must to record an IPPhone.   TDMRecorder should but not must to record an TDMPhone. An actual recorder is a host in that case that is represented with an `IP`. I was trying to implement it that way, that I would be able to change dynamically during _runtime_ the resource the a phone is been recorded on (an `IP` address). As I understood the part that is missing for me is to have under Record class an abstract method `startRecording` and the ability to change the recording resource from `IPRecorder` to an `TDMRecorder` and vice versa? Is the problem that I defined suitable for a strategy design pattern?


title: What is the “App Id” when i create new GTKmm app?

text: While writing new application using GTKmm. the first line is :                Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc,argv,"org.gtkmm.examples.base");      and i knew that "org.gtkmm.examples.base" is the application ID , my questions are : 1 - what is the application id?. 2 - how do i write it?.


title: How to use github, branches and automatic releases for version management?

text: I understand most of the basic Git/Github concepts by now, however I still have trouble understanding the bigger picture. These are some things that I have managed to get working so far:   * Push commits   * Work with branches   * Integrate Github with Travis CI, a continuous integration system   * Via Travis CI, automatically build on every commit to master and put the release as a ZIP on Github under releases. However I have only worked on alpha/beta versions of projects so far, so I've never seen versioned releases in practice yet. Thus I want to learn more about versioning, maintaining separate versions, hotfixing the versions, etc. How would I ensure that the following things happen:   * Have different versions of my project, for example version 1.1.0 and 2.0.0   * Have the ability to push hotfixes on the versions, sort of bumping the version to 1.1.1 or 2.0.1, etc.   * Make a continuous integration system build that version automatically on commit and if succeeds, then publish a release for that specific version. I am doubting between the following options:   * Do I need to use tags for every version? If so, how can a continuous integration system build releases automatically?   * Should I create branches for every version? If so, would that not create a whole ton of branches (like an 1.1 and a 2.0 branch, hotfixes go onto that branch of course)   * How would I specify the version number? Is it okay to have a configuration file that specifies the version number, or are there smarter ways around it? In this case it would be a Java project, if that matters.


title: What alternatives are there to using HTML/CSS layouts for websites?

text: Is there any existing in-use, or even just conceptual attempts at creating a markup or programmatic expressions for designing the layouts of websites other than HTML/CSS? If there are others out there and they do not appear to be in heavy use. Why is this?


title: Appcelerator needed? Have we gone wrong with mobile development

text: We just got into mobile development at our company and see some potential even for a company like ours which is mainly engineering. I'm not talking about cad on the mobile platform I'm mainly suggesting we can make use of mobile for internal applications like a content management system / CRM / internal apps in general. Suddenly I am getting email from a company called Appcelerator: http://www.appcelerator.com/. Our mobile architecture is mainly for our android environment as we are dealing with android phones. However, our API's return data in json format which I believe apple / window / any gadget can clearly understand. The folks at appcelerator continue to email me saying mobile development is a beast and writing a "mobile tier" is a huge burden. I'm not sure what this guy is talking about, our API's are already written (doesn't matter what language, but they are written) and our systems / devices make use of that API as if they were black boxes. For instance, our mobile devices and our actual asp.net application make use of the same data without writing any code (they merely call web methods). The web methods simply return the results in json format. They continue to harp about how great their product is and how we need it. But their own video seems to show that they merely take a data source (Doesnt matter if its sql-server, oracle, or sap, etc.) and convert the data to json format. Which we already do...see their video here: http://www.appcelerator.com/platform/video/?mkt_tok=3RkMMJWWfF9wsRonuK%2FNd%2B%2FhmjTEU5z16uglWK6%2Fi5h41El3fuXBP2XqjvpVQctqNrHYDBceEJhqyQJxPr3DL9YN1N13RhnlCQ%3D%3D Specifically the second one called "Great mobile apps, quickly at scale". I watched that video (its rather short) but notice how they mention pulling data in different formats is difficult because devices don't understand the format. Then they slam the appcelerator logo on the video and pump out little json widgets as animation - but we are already doing that. Does anyone use appcelerator or can give me any reason why we would need this. Aside from analytic s as we are not at that point already. **Folks I am not asking about how to get out of this e-mail / spam. I am asking if our mobile strategy (At least from the sounds of it) is okay...I mean there system seems to take a dataset and spit it out in a common format (namely JSON)...we are doing this..so were did I go wrong? Again please don't think I am asking for a recommendation on how to get a salesguy to leave me alone.**


title: TDD adding simple properties

text: I am currently doing my first real project with TDD. I have written tests, and implemented most of the logic for the application. However, there are properties I know I need to have on the UI, however, there is really no way to write a useful test which will cause their creation. For example, a description field. It's the ID that is really cared about in the logic of the application, but the actual description is just carried along from when it's populated and sent to the UI. How would you go about writing a test that is worthwhile, since a new property is literally nothing more than.               public string foo { get;set; }


title: Good design for a recreation of pokemon

text: I'm currently working on a group project to recreate the original Pokemon Yellow version in Java. We've only just started planning it out but they way we've drawn out the design right now is to have an abstract Pokemon class and have 151 (Count of the original Pokemon) classes that extend it, each one being a different Pokemon. Each class will be able to store data such as an ID, its name, the type of Pokemon it is (ie: rock/water/fire/etc), and the moves it can use and learn. It seems a little much to be creating 151 classes for the Pokemon but it also seems like a good way to limit coupling. As far as design goes is this a good way to go about doing it, if not what are some better methods to go about doing it?


title: How can I apply OOP concepts to building a simple, but real-world, web app?

text: I've been trying now for a long time to wrap my head around OOP. I see its advantages. I've read many, many tutorials and watched an equal amount of videos on the subject. I get the animal/cat/dog examples, I get the car/drive examples. What I'm struggling with is how to apply these concepts in a real- world application. So, I've set out to build one using OOP. I am not asking for help with syntax or writing specific code — I can find that myself in documentation and by searching forums etc.. What I really need is some guidance, and a push in the right direction every now and then. Are there any seasoned programmers willing to mentor me? As my learning project I would like to build a simple classifieds "web app". Something similar to Craigslist but way watered down in terms of scope. I would like to use PHP5 and MySQL, because I am familiar with them. Let's say there are only these 2 use cases:   1. Posting something for sale   2. Browsing/searching for something to buy What "things" should be objects? I can imagine that each item could be an object, but at what point? And why? So for example, the user fills out the "post item for sale" form, should that form get turned into an object which gets passed to another object which inserts the values into a database? What about when another user is browsing and requests to see all items of category C? Does it make sense that whenever the app has to connect to its database it creates a database object and then gets a bunch of item objects and displays them on the page? …writing this out certainly makes me realize how clueless I still am about OOP. Please help me fix that. If in your opinion this is not a good project to start wading into OOP with, please feel free to suggest another idea!


title: Storing User Form Data

text: I am trying to come up with a data schema/methodology for storing the data collected from various different user application forms. All forms contain the basic info like name, address, etc but then they diverge in what they collect. Each application will have its own unique subset of questions they want to ask. Because of this one "answers" table is out of the question. Would i be better off normalizing the database into a questions table and answers table? Another option considered would be to have a table of answers for the standard/universal questions and then serializing and storing the other answers in a field. Given that, would i be better moving to a straight up nosql database option? Maybe nosql is overkill and i really just need EAV? Once information is collected, it won't be edited. Just needs to be read.


title: What's the DCPU-16 thing all about?

text: Ever since Notch (of Minecraft fame) announced his next project will include programmable 16-bit CPUs ingame everybody seems to want to write VM's for the specification Notch has written up. I've seen them written in C, C++, Go, JavaScript, CoffeeScript, etc. What's so special about the specification Notch wrote up or is it just that it's the first game that actually contains a CPU ingame that you can do whatever you want with? It sparked my curiosity, but I fail to grasp the thing that makes it so special suddenly everybody needs to write up code for it?


title: Are there tools that do automated validation of database standards?

text: I'm looking for something akin to FxCop, but for databases. Basically, I want to have a tool where I configure my database standards (naming conventions, field types, or more complex custom rules). Then, I want to incorporate that tool into my continuous integration process so that any violations are flagged immediately. We support both Oracle and SQL Server so tools that address either of those is good, but one tool that supports both would be better. Do tools such as this exist or perhaps there is some better method or type of tool that I can utilize to help me achieve this goal?


title: Testing for Authentication loop holes / bugs

text: We've got a web application which is 99% complete prior to public beta, were currenlty securing the site from security perspective, locking down the server, db etc, one thing I'm concerned about but not really sure of the best way to test is for authentication loop holes. For instance there a 3 user types - System admin, Staff, Client. There are urls on the site that I would only want the System admin to be able to access, and there are other pages, that I would want everyone to access, but not view all of the data. System admin would be able to see everything, but Staff and Client would be able to see some content, similarly some pages would be read only for some users. Is there a workflow for testing this, at the moment I've come up with a script that has the credentials of a each user type and goes to every url on the site trying to access pages and reports if it's able to see a page it's not meant to, similarly it checks for read / write data on the page.   * Is there anything else I should be checking for to make my authentication tests more robust ?


title: Question for Enterprise control language(HPCC)

text: does anyone got some idea about ECL which is Enterprise control language used in HPCC(high performance cluster computing) used for distributed computing? i got some problem and not getting any answer after lot many tries any help will appreciated. thanks


title: MIPS has been used a multiprocessor architecture in the past. Is anyone using it in a multicore SoC?

text: I have been reading about the MIPS architecture and learned that it has been used a multiprocessor architecture in the past. Is anyone presently using it in a multicore SoC?


title: Steps to create a solution for a problem

text: I am a trainee. According to my teacher to solve a problem we should go through following steps:   1. Create Algorithm (optional)   2. Create a Datatable: By analyzing the problem, create main concepts in those problem as columns and the related issues in the main concept as rows.   3. Create a Flowchart based on the Datatable. (when creating flow chart, think that you are in that situation and design it in your brain)   4. By seeing the Flowchart, one can solve the problem easily and in efficient way. These steps should always be considered by a programmer if he/she wants to become a Software designer (not just a programmer) because this approach gives an efficient way of finding solution to a problem even if the problem is small. According to him, this way of approach also works in real time scenario's. My question is: Is this really an efficient way? please share also your thoughts. Through this question I also wanted to share some thoughts of my teacher with you who is a good mentor.


title: What is meant by XML/XSLT/XPath and asynchoronous programming?

text: I understand that (1) XML/XSLT/XPath and (2) asynchoronous programming may not be related to one another. My questions are:   1. When a C# developer job is advertised saying: "the following skill is required as mentioned in 1 and 2", what does it actually mean?   2. Lets say I need to master these two topics (1 and 2). What do I need to do to accomplish that skill? If there are some books for intermediates that actually teach that stuff with practical scenarios and case studies then please suggest some. Answers are much appreciated. I have worked XML packet crafting for message exchange over the network, developed some amateur XML parsers for some projects and done message exchange for a client server based messaging system using asynchronous calls. But I really need to know and learn what the companies are looking for when they write these things (1 and 2) as requirement in their job advertisment. Aggregate skills required for the specific job were:   * ASP.NET 2.0 (OK)   * Web Services and .Net Remoting (OK)   * XML/XSLT/XPath **(?)**   * Asynchoronous Programming **(?)**   * Windows Services (OK)   * Javascript/XML/AJAX (OK)   * Microsoft Silverlight/WPF (OK) So firstly, it's clear that AJAX is not related to Asynchronous programming (in this very specific context) as it is written as a **separate** required skill (and I hope that it's not a mere redundancy). In normal cases, my deductions would have been the same like asynchronous programming means working with AJAX (asynchronous JavaScript with XML). Secondly, making a web service in C# does not require any **extensive** experience with **XSLT**. In fact, exposing functions from a DLL (encapsulating business logic) is the most simplest of any task with web services in C#. I wonder if there is some extra skill or experience that is needed?


title: Should I include `assembly` as programming language in the CV?

text: In the answer for one question someone wrote that `assembly is not a language, it's a process`. I tend to agree, since the assembly "language" is dependent on the architecture it will run on, which may differ quite a bit from one CPU to another. So if you've written assembly for one architecture, does that mean you can include it in the CV under merely `assembly` along with the other programming languages? Or do you explicitly say that you've written assembly for that particular architecture? **EDIT:** Changed 'dabbled' to 'written'. English isn't my native language and I misunderstood the term, thinking it meant that you've used it a lot instead of just a bit.


title: PHP objects with configurable data interfaces

text: I have a `User` class which needs to load data from a variety of sources, e.g. the main user database, WordPress user metadata, authorizations from another app, etc. For the sake of organization, I want to separate out those different data loaders into their own classes. Calls to `$user->get_name()` would appropriately delegate down to whatever backend object provides this information. How might this look in PHP? Is there a name for this pattern? (And hopefully it's not an anti-pattern.) I can anticipate people suggesting some embedded objects, like `$user->wordpress` as an interface to the WordPress loader. I have an additional complicating factor, that not all users are present in all of our data stores. My loaders are able to identify if they understand and have data for a given username/id, and they're loaded into the `User` object with a priority level. A given identifier may only trigger a subset of data loaders, so `$user->get_name()` essentially is a consistent interface to user data, wherever it's stored. I'm evaluating my setup in an effort to make things more testable, and I believe this is an appropriate first step.


title: Why do new programmers seem to ignore compiler error messages/runtime exception messages?

text: I think we’ve all seen this. Beginners ask questions on StackOverflow that follow the basic outline... > I’m trying to do _(very vague description of the goal)_ but it doesn’t > work/I get an error/exception. Please help! Isn’t it bizarre that so many of them seem to consider it unnecessary to paste the error message? I wonder what the psychology of this is. What is it about error messages that makes people initially assume that they are useless and not worth paying any attention to? The answer I’m looking for is _not_ “they don’t understand the error message”. That doesn’t explain why they wouldn’t consider telling anyone else who might understand it.


title: Help parsing long (3.5mil lines) text file, line by line and storing data, need a strategy

text: This is a question about solving a particular problem I am struggling with, I am parsing a long list of text data, line by line for a business app in PHP (cron script on the CLI). The file follows the format:                   HD: Some text here {text here too}              DC: A description here         DC: the description continues here         DC: and it ends here.              DT: 2012-08-01              HD: Next header here {supplemental text}              ... this repeats over and over for a few hundred megs      I have to read each line, parse out the HD: line and grab the text on this line. I then compare this text against data stored in a database. When a match is found, I want to then record the following DC: lines that succeed the matched HD:. Pseudo code:                   while ( the_file_pointer_isnt_end_of_file) {             line = getCurrentLineFromFile             title = parseTitleFrom(line)             matched = searchForMatchInDB(line)             if ( matched ) {                 recordTheDCLines  // <- Best way to do this?             }         }      My problem is that because I am reading line by line, what is the best way to trigger the script to start saving DC lines, and then when they are finished save them to the database? I have a vague idea, but have yet to properly implement it. I would love to hear the communities ideas\suggestions! Thank you.


title: Check parameters annotated with @Nonnull for null?

text: We've begun using FindBugs and annotating our parameters with `@Nonnull` appropriately, and it works great to point out bugs early in the cycle. So far we have continued checking these arguments for `null` using Guava's `checkNotNull`, but I would prefer to check for `null` only at the edges-- places where the value can come in without having been checked for `null`, e.g., a SOAP request.               // service layer accessible from outside     public Person createPerson(@CheckForNull String name) {         return new Person(Preconditions.checkNotNull(name));     }          ...          // internal constructor accessed only by the service layer     public Person(@Nonnull String name) {         this.name = Preconditions.checkNotNull(name);  // remove this check?     }      _I understand that`@Nonnull` does not block `null` values itself._ However, given that FindBugs will point out anywhere a value is transferred from an unmarked field to one marked `@Nonnull`, can't we depend on it to catch these cases (which it does) without having to check these values for `null` everywhere they get passed around in the system? Am I naive to want to trust the tool and avoid these verbose checks? **Bottom line:** While it seems safe to remove the second `null` check below, is it bad practice? This question is perhaps too similar to Should one check for null if he does not expect null, but I'm asking specifically in relation to the `@Nonnull` annotation.


title: Getting started with version control and its integrated project management?

text: I am given the charge of finding a **version control + project management setup** , and also training and maintenance, in addition to my regular jobs; I will be known as "the git guy" (or whatever) from now on. We develop PHP (in netbeans), C# (in VisStudio) and Python in windows XP and Fedora. The system is to be hosted on Windows. We are five-strong and may aggressively jump to 8-10 soon I myself shortlisted **Mercurial + Redmine** by rationalizing. My rationales are:   * Its easy to admin and maintain   * easy to get started in Mercurial and has a gentle learning curve   * It supports solo and few-people workflows equally well   * Mercurial has usable GUI tools   * Redmine has a **stable and integrated** interface to Mercurial (TRAC is skirting around stable Mercurial support, making me nervous)   * Netbeans has **stable and usable** integration with Mercurial (I know Netbeans ships with Mercurial support but...) **My questions** (in order of importance) are:   1. Are my rationales valid or will my assumptions lead to costly mistakes later?   2. Does this combination have issues that severely affect usability?   3. Are there less painful combination for our small team (SVN+Trac for example)? Some in SO have the opinion "Just get started!", but I want to play it safe.


title: Multiple database accesses or one massive access?

text: What is a better approach when it comes to performance and optimal resource utilization: accessing a database multiple times through AJAX to only get the exact information needed when it is needed, or performing one access to retrieve an object that holds all information that **might** be needed, with a high probability that not all is **actually** needed? I know how to benchmark the actual queries, but I don't know how to test what is best when it comes to database performance when thousands of users are accessing the database simultaneously and how connection pooling comes into play.


title: How common are generic-case exponential time algorithms in production software?

text: I know that exponential time algorithms should generally be avoided but are sometimes necessary. A case being the Traveling Salesman. How common are such algorithms in production software? Are these cases typically necessary or a result of rush jobs? I understand that many can be solved with a good heuristic. What is typically done with those that cannot?


title: printf - source of bugs?

text: I'm using a lot of `printf` for tracing/logging purposes in my code, I've found that it's a source of programming error. I always found the insertion operator (`<<`) to be somewhat of a odd thing but I'm beginning to think that by using it instead I could avoid some of these bugs. Anyone ever had a similar revelation or I'm just grasping at straws here? # Some take away points   * My current line of thinking is that type-safety outweighs any benefit of using printf. The real problem is the format string and the use of non type-safe variadic functions.   * Maybe I won't be using `<<` and the stl output stream variants but I will certainly look into using a type-safe mechanism which is very similar.   * A lot of the tracing/logging is conditional but I'd like to always run the code to not miss bugs in tests just because it's a rarely taken branch.


title: Create many similar classes, or just one

text: The goal is to create an application that has objects that can represent some operations (add, subtract, etc). All of those objects will have common functions and members, and thus will either implement an interface or inherit from an abstract class (Which would be better practice, this will be in C# if that matters?). As far as I can see, there are two different ways of organizing all of these classes.   1. I could create an addition class, a subtraction class, etc. This has the upside of being highly modular but the difference between classes is so minimal.   2. I could create one class, and have a member that will say what type of operation is being represented. This means lots of switch statements, and losing some modularity, in addition to being harder to maintain. Which is is better practice? Is there a better way of doing that is not listed above? If it matters, the list of functions that should be supported is long.


title: When calculating how many days between 2 dates, should you include both dates in the count, or neither, or 1?

text: I am trying to make an algorithm that counts the days between two dates, e.g. between 3/1/2012 and 3/2/2012. What is the correct answer, or the most popular choice? Should be the one I use? In this case, if I don't include both dates I am comparing, the days are 0; if I include one of them, the days are 1; if I include both, the days are 2.


title: How many story points should you allocate in an initial sprint?

text: When first implementing Scrum within a team, how should you go about determining the amount of story points that are in an initial sprint when you have no idea of the team's velocity? Should you base this on an estimate of hours and only use the points at a later stage?


title: How to improve my trade

text: I'm currently working as a software developer and studying for a software engineering degree (the former whilst not doing the latter). I'm confident in my ability to do my job competently, but I feel I could do it better. I know my greatest pitfall is in my business skills; for example, I often don't understand at first why I'm asked to implement something in such a way, because I haven't understood the business requirement behind it. Does anybody have any good advice on improving my business skills? Or is it something that comes with experience?


title: Recommendations for books for learning computer science on your own?

text: Can you guys recommends which books are best, to learn what's taught at most undergraduate and graduate computer science programs. Specially by the specific areas (like AI, Software Engineering, etc). I'm very interested in learning everything i can. And i hope this help other people that are interested like me. Thanks for any help you can give - i really appreciate it.


title: Is there any reason not to use Optional as a method argument in the case where you know the argument is something that may or may not be needed?

text: With Java 8, I've seen more and more articles about the use of Option/Optional. I understand what they trying to represent, and I see many examples of them being used as returns. However what I don't see is them being used as method/function arguments in languages that don't have the syntax for default/optional parameters. Is there any reason not to use `Optional` as a method argument in the case where you know the argument is something that may or may not be needed? Here's an example I could think of:               Optional<Customer> lookupCustomer(String firstName, Optional<String> middleName, String lastName)


title: Is it correct to call the assignment symbol an "operator" when it is actually a statement?

text: In some languages (C++, Java, Ruby, etc.) an assignment returns a value and can be used in an expression:               x = (y = z);    // ok, 'x' gets the value of 'z'      In other languages (Ada, VHDL), an assignment is a proper statement and cannot be used in as expression:               x := (y := z);   -- error!      However, in both cases, it is possible to find teaching material where the assignment symbol is called the "assignment operator". My question is, is it technically correct to call the assignment symbol an "operator" in the second case, where it is actually a statement, does not return a value, and cannot be used in the middle of an expression?


title: Why can't a server continue to act on a request after sending the response?

text: Say for example I've got a RESTful webservice, and I need to support creating a widget via a POSTed http request. I need to   1. Deserialize the POSTed widget.   2. Validate the deserialized widget.   3. Persist the widget to a backing service.   4. Send a success response back to the client. Now, the problem is that my SLA does not allow 3 to block 4--persistence in this case takes too long and the client needs to know right away that the request has succeeded (this is the standard use case for the `202` http status code). Almost everywhere I look, the assumption is that the way to solve this is to "background" the expensive persistence part. This is typically an awkward process with many moving parts and often its own latency (e.g. making a blocking call to a separate queuing service). Simply parallelizing 3 and 4 using native constructs is generally out of the question, as is switching the order so that 4 blocks 3. As near as I can tell, this is mainly because the web and app servers are built with the fundamental assumption that a process (and any children it's forked off) is free to be killed/reused as soon as it's sent its response. Or, equivalently, that the response can't be sent until the app has finished doing everything it's going to do. This is intensely frustrating to me! In any other context, I can do what I like with the program's control flow. But when I'm running a Phusion Passenger -> Ruby on Rails setup, and I want to do a thing after I send the response, I'm left with a wide variety of baroque options that all seem to consider it perfectly natural and acceptable to, say, serialize the application state, post it to Amazon SQS, have basically separate web service that polls SQS, deserializes the old application state, then do the thing. I had application state all set up the way I wanted it after sending the response! Why isn't anything written so I can just do               def create       widget = Widget.new(params[:widget])       if widget.valid?         respond_with(widget)         widget.save       else         respond_with(widget.errors)       end     end      Why is there a pervasive assumption that web service stacks will never support this kind of flow? Is there a hidden drawback, or tradeoff, to making it possible to do this?


title: How to capitalize maximally on location-independence … my personal #1-incentive for working as a developer

text: To me the ultimate beauty in working as a developer is the fact that given a nice CV, your are going to find a new job, everywhere at any time. So I would like to ask if somebody here as experience in working while travelling for example. Or job-hopping from metropolis to metropolis every, say, six months. For example I have been investigating for how to get to Brazil. But it seems like that working as an employee in Brazil would be no option, b/c it takes a lot of time/money/effort to get the proper visas and permissions. So the only practical solution would be to freelance and the just travel, while getting your job done wherever you are. I bet my ass that there are loads of IT-guys out there and on here who know exactly what I am talking about. I'm looking forward to interesting ideas and stories. **EDIT** for the BOUNTY: I am not so much intersted in general wisdoms but rather in concrete accounts of personal experiences addressing the subject from people who can relate to my question and do have actual personal experiences to share. I am not asking for opinions and accounts of second-degree nature. **EDIT** for **_EVERYBODY_** (concrete questions):   1. Where do you work while travelling? (office pooling? libraries? cafés?)   2. Where do you sleep? I guess hotels are somewhat to expensive. (hostels? couchsurfing?) **EDIT** I accepted Andy's reply as "the" answer mainly b/c of its romantic and positive undertone. Though of course there is not THE answer to that question. I was hoping for an intriguing discussion and given 11 vote ups and 5 bookmarks I seem to be not the only one who is interested in some input. So I hope some more people chime in and share their experiences.


title: PowerShell guide or reference for .Net Framework?

text: I'm a java dev that is new to powershell. I know that it's built on the .Net Framework, but I don't have much knowledge with that framework. Is there a reference guide of some sort that shows what libraries are available in Powershell? I found a list of Powershell 2.0 commands, but I'm pretty lost as to what library to use or what is available from the underlying framework.