How can I estimate the value of an open-source project?

I am trying to generate a metric for a company cost savings goal. To do this, I want to estimate the savings we realized by using an open source web application rather than building it from scratch or buying a COTS solution. One step in the process is to estimate how much it would have cost us to develop the application ourselves. Unfortunately, I'm at a loss for a really simple way to do this without going through a full estimation process. Since I have the source code, I would think there should be some heuristic that could give me a very rough estimate of developer hours needed to write it. Unfortunately, my web searches on the topic mostly turn up articles and opinions on how lines of code are not a good indicator of productivity or quality. My best solution so far is to pick a number of lines a developer could write in a day and work out the number of developer hours from there. If I go with that method, I would like to have some (preferably research based) evidence to back up my claim of developer productivity. The one thing I have going for me is that to generate my final metric, all I really need is a lower bound on the developer hours or cost of the project. The higher the estimate, the better my metric will be, but I would rather the estimation technique be unassailable than have a high number. Is there a better way to estimate the value of an open-source project?


creative & complex vs simple and readable

Which is a better option?   It's not always that when you have something creative your code is going to look ugly.   But at times it does go a bit ugly.   e.g.               if ( (object1(0)==object2(0) &&          (object1(1)==object2(1) &&          (object1(2)==object2(2) &&          (object1(3)==object2(3) )         retval = true;     else         retval = false;      is simple and readable               bool retValue = (object1(0)==object2(0)) &&                      (object1(1)==object2(1)) &&                      (object1(2)==object2(2)) &&                      (object1(3)==object2(3));      but having something like this will make some newbies scratch their heads. So what do I go for? including simple code everywhere might sometime hamper my performance.   What I could think of was commenting wherever necessary but at times you get too curious to know what is actually happening.


Generous budget: what's your ideal setup?

If you had a generous, but not ridiculous budget (ie no yachts!), describe your ideal setup for programming. What hardware would you have? Desktop and a laptop or just one or the other? How many screens - two, three, four, more? Private office, work from home, cubicle? What operating system(s) would you be using? What tools would you have - IDE, other tools, databases, VCS, documentation? What local development and test servers and other services would you want - VCS server? Build server? database server?


Is Lambda Still Supported In Python?

Only one or two years ago, I remember reading Python constructs that would be removed from Python -- reduce was one of them -- and other constructs that would be emphasized like comprehensions and generators. I saw a very nice description of how Python could be made more functional here, and I was wondering on which list lambda appeared, supported or soon-not-to-be supported.


What is this boolean law?

A friend of mine has shown sometime ago the name of the below boolean technique/law but I forget that name unfortunately. Does someone know what it's called? example in C language:               !(a || b)      It's a short to:               !a && !b


Origin of letter "X" for close icon

Who exactly presented the idea that letter "X" should be used for closing/exiting a window or an application? According to Medium.com, > The first appearance of [x] in GUI design was likely the **Atari TOS** , > possibly influenced by the Japanese **batsu** and **maru** conventions. > Thanks to a last minute design change in **Windows 95** , and the mass > adoption of Windows worldwide, [x] has become the standard symbol for > ‘close’, a symbol that dominates web, app and software design today. It is stating that letter "x" for closing/exiting a app originated around 1995 but according to my senior, letter "x" for exit was used first in 1980's in **wordstar 4** on CP/M OS. ![enter image description here](http://i.stack.imgur.com/aDnDY.png)


What do I need to learn to decide on rename/recompile source package names because of company rebranding?

My company is currently at a rebranding process and the brand names have been used in the sources' package names but these names are only visible to developers who maintain this code so nobody from project management is really interested in changing them considering also that it would imply the recompiling of several old components. What factors do I need to consider when deciding on a change like that? I don't know if I should worry about legal issues or not and if so, how to address this with project management. * * * More background details. I have all the sources and dependencies but since the company rebranding, other development areas have adopted some of the code that needs package name-changing so I cannot take the decision only by myself so I don't make everyone else's code to crash with my core components and I cannot change other areas' code without the permission of those areas' users so yes, my concern is more political than technical. I am going try to coordinate the involved it areas to make the change anyway, since it seems to be the best approach.      Unfortunatelly in my company there's no continuous integration build server so we build our code manually on demand and to get something to production I have to justify the change (even just the package name changing) to QA with an user requirement and some other bureaucratic documentation so that's why I was hesitating the change in first place.


How not to degenerate into only a programmer who stitches together APIs?

This one I heard when I was recently interviewing a person and asked him why he was looking for a change within an year of joining his previous company. Particularly a company which is known to be in the business of processing high volume transactions, 100s of 1000s of orders flowing through the system every minute etc., etc. (you know what sells, so lets cut it) What the candidate told me was interesting -- he had joined originally hoping to be able to get into the lower layers of the system, understanding the secret sauce that binds a high volume reliable system etc. What he ended up doing was using a lot of tools - open source and commercial, and was in the business of just glueing it all together, which never gave him any understanding of the real deal. There were tight work deadlines too, so he couldn't really get into the hang of at least the open source stuff either. I had to agree here. But tell me then, how would you prevent yourself from degenerating into an API stitching kind of a programmer in this specific situation? Are there any signs in the job interview process itself that signal you of this degeneration?


How can I determine the level of talent a prospective programmer has?

I have a friend who asked me whether I can be her mentor as a programmer. I had to tutor several junior programmers in the past so I have experience working with / tutoring people on different skill levels. This is the first time however when there was no **pre-filtering** and the future programmer is an **absolute beginner**. Is there a method that has a chance to work in order to tell someone's innate talent level?


Abstract classes in package structure

I have an abstract class that will have many implementors. There are, of course, many places to put abstract classes in a Java package structure. Should the abstract class be in the same package as the implementors, or should it be in an "abstract package" package, or somewhere else? Please explain why you would place it there - I'm looking for design discussion, not just what I should do in this particular case.


Skillset improvement in coming new year

Here is a little background information.   1. I have been working for Java 10 years.   2. The product I am working on went to live about 3 years ago. Now, the product is getting stable.   3. After all the post-product drama, I gained a lot of knowledge about Oracle & SQL. People(mainly management) were desperated enough to give me deep oracle-related task over DBAs. I admit I considered becoming DBA but eventually decided to remain as a programmer.   4. DBAs & Management are demanding all the DB & Query related task back to DBA, which makes me a bit sad.  **In short, I anticipate a lot of time next year**. What would you do to improve your skillset?? I am thinking to upgrade my Java version(Not from experience though, we are using JDK1.5) to 1.6 getting certificate. Any good idea from fellow developers?? \-----------Edit --------------------- How about data modeling for application? Do you guys think it is developer role??


What reasons do you have/give for using an MP3 player/iPod while programming?

At my last job, as a Project Manager, I argued (unsuccessfully) for the Developers to be able to use MP3 players while they were working. Unfortunately, the culture in that company was such that many of the so-called business people could not cope with the concept that some people would be able to use their music players, whilst others (e.g. Call Centre staff) could not. The company I worked at before that (as a Software Development Manager) were open to Developers using their iPods, and I found them more productive because of it - albeit they weren't allowed to plug in their iPods to their PCs for security and copyright reasons. So to help me in my next job, if I come across this situation again, how would you successfully put the rationale behind allowing MP3 players?


Is the addition of a duration to a date-time defined in ISO 8601?

I've writing a date-time library, and need to implement the addition of a duration to a date-time. If I add a 1 month duration: `P1M` to the 31st March 2012: `2012-03-31`, does the standard define what the result is? Because the resulting date (31st April) does not exist, there are at least two options:   * Fall back to the last day of the resulting month. This is the approach currently taken by the ThreeTen API, the (alpha) reference implementation of JSR-310:               ZonedDateTime date = ZonedDateTime.parse("2012-03-31T00:00:00Z");     Period duration = Period.parse("P1M");     System.out.println(date.plus(duration).toString());          // 2012-04-30T00:00Z        * Carry the extra day to the next month. This is the approach taken by the DateTime class in PHP:               $date = new DateTime('2012-03-31T00:00:00Z');     $duration = new DateInterval('P1M');     echo $date->add($duration)->format('c');          // 2012-05-01T00:00:00+00:00      I'm surprised that two date-time libraries contradict on this point, so I'm wondering whether the standard defines the result of this operation?


Can I assume interface oriented programming as a good object oriented programming?

I have been programming for decades but I have not been used to object oriented programming. But for recenet years, I had a great opportunity to learn OOP, its principles, and a lot of patterns that are great. Since I've learned OOP, I tried to apply them to a couple of projects and found those projects successful. Unfortunately I didn't follow extreme programming that suggests writing test first, mainly because their time frame were tight. What I did for those projects were   1. Identify all necessary classes and create them with proper properties and methods   2. whenever there is dependency between classes, write interface between them   3. see if there is any patterns for certain relationships between classes to replace By successful, I meant that it was quick development effort, the classes can be reused better, and flexible enough so that another programmer does not have to change something else to fix another part. But I wonder if this is a good practice. Of course, I know I need to put writing unit tests first in my work process. But other than that, is there any problem with this approach - creating lots of interfaces - in long term?


What are some best practices for populating and using a test database?

So, I'm developing some database-driven RESTful Java web services, using Hibernate and MySQL. For testing purposes, I'm using the H2 in-memory database. H2 is nice and fast, so this has worked out really well. The only problem is that populating the DB tables prior to my tests is sort of tedious. I basically create and persist a bunch of objects by hand. I'm wondering if maybe I'm going down the wrong road. Please tell me, what are the best practices for doing what I'm trying to do? Any tools that could help me? Any general strategies or tips?


Does NaCl mean the death of Internet Explorer?

From the wikipedia - > Google Native Client (NaCl) is a sandboxing technology for running a subset > of Intel x86 or ARM native code using software-based fault isolation. It is > proposed for safely running native code from a web browser, **allowing web- > based applications to run at near-native speeds**. (Emphasis mine) (Source) Compiled C++ code running in a browser? Are other companies working on a similar offering? What would it mean for the browser landscape?


What's new in Windows 8 for desktop apps?

I see all kinds of demonstrations about Build of the new features in Windows 8 for Metro apps, but not much for Desktop applications. Is there anything new for desktop-style apps; or has nothing changed?


What are some good tasks to assign co-op students/interns?

My company is investigating hiring a University Computer Science co-op student (BSc year 3) for a 4- or 8-month work term. (I'm not sure how internationally- recognized the term co-op is - it's essentially a paid internship, after which the student returns to their studies.) My team develops a web application in ASP.NET and handheld thick clients on iOS, BlackBerry, and Android. For any of you that have brought interns into an experienced development team, what kind of tasks did you find for them to do? I realize that's a hard question to ask since any answer can be quite specific to an individual business. I'd expect the following:   * Tasks that require mentoring but not babysitting   * Tasks that will take a few weeks to finish (so the mentor can remain productive)   * Tasks that expand the student's understanding of software development I've considered things like expanding code coverage in our unit tests, or developing a feature that's been designed, or improving/writing missing requirements documentation from features that were added without any supporting documentation. I never did an internship so I don't know what sort of tasks are valuable to both the student and the company. Any recommendations? Edit: These are all excellent and thoughtful answers that have helped me a great deal. Thank you all very much. I can only choose one answer, so I'll go along with the crowd and accept the most popular one.


Why is PHP so frequently used on web servers?

My web server uses PHP as do 76.9% of web servers according to W3Techs: http://w3techs.com/technologies/overview/programming_language/all The reason I use PHP is an inertia born out of seeing everyone else using it on web servers. What is it about PHP that would make it so ubiquitous on web servers? (Note that this question is similar to the following question but takes it in a different direction: Why isn't Java used for modern web application development?)


How do Programmers in the East see programmers in the West?

The other half of this question: How do programmers in the west see the programmers in the east? I think it's just as interesting and important to see how programmers in the east view programmers in the west. * * * The eastern part of the world (India/China/Philippines ) is often seen as mainly providing outsourcing services to the western world (USA and Europe). Do you have the experience of working as part of an offshore team? If yes, how was it? Do you hold any generalized ideas or opinions about the programmers from the West (e.g. Are they cooperative, do they deliver on time or do they do quality work?)


Recommended requirements when outsourcing xhtml/css site building?

I'm considering outsourcing a part of our web application development project for freelancers, namely the site building part. What I mean by site building is the process of creating the xhtml/css template files, with dummy content, from a psd file (or any other graphical layout file). The resulting xhtml/css files will be used by our developers as templates for cms based page rendering. The cms in this case is Drupal, but that might not be of much relevance. I'm looking for a good set of requirements, that   1. will result in good quality xhtml/css code, complying with today's standards   2. leaves little to the freelancer developer's imagination in terms of what I need I'm thinking about requirements like:   * Valid XHTML 1.0 Transitional document type, validated by validator.w3.org   * Identical rendering in all modern browsers (FF, Chrome, Safari, Opera, IE7-8) and also in IE6   * All opening and closing block-level elements should be properly commented, referencing the functional part of the user interface they belong to (menu, toolbar, content, etc)   * No inline CSS definitions And so on. How would you organize a list like that? What requirements would you add? Edit: started bounty. I'd like to have a clear set of requirements that will save me some troubles.


Should I use session or cache to keep the time it last polled when polling to server at intervals?

I'm building a web chat app using session to keep the time the app last polled so that the server can determine whether messages exist between the current polling time and last polling time. It works well however, there are few instances whereby the messages sent from client A is not received by client B or the same message is produced twice on client B. Of course, the messages are not lost, always stored in the db after they are sent. I'm wondering, is this related to my usage of session storage whereby the last and current polling time of both clients are **always different** (due to session data not being accessible by other user/client)? Or should I change to cache storage so that the last and current polling time of both clients to the server are **always the same**? p.s. I'm using Apache server and MySQL though with AJAX setTimeout() function to poll the server at regular intervals.


What is the best way to use inheritance with ORMs?

If I have a People table and those people can be at different addresses, and each address can have more than one person, thats a many-to-many relationship. So, using ORMs like Entity Framework and Django, I've got the hang of doing that. But my problem is that there are different types of people, like employees and customers and other clients that all have these fields also. This would leave me with a top level class called Person which has a many-to- many relationship with Address and then these other classes (Customers, etc.) that inherit from person. I read that there are different types of inheritance, so what would be the best approach?


What is the maximum value of index of an ArrayList?

I was thinking about it. You may have access to endless memory (one computer with lot of RAM) so that you can keep on adding more and more elements to your ArrayList. But, I think that you can only access elements BY INDEX up to a certain value of index. The maximum size of this index could be = maximum number your computer can represent, that is long 9,223,372,036,854,775,807 in Java. I know that you can access the NEXT element using an iterator. But, how do i access elements after the (9,223,372,036,854,775,807)TH index, using an index number ?


Tools for modelling data and workflows using structured text files

Consider a case when I want to try some idea of an application. But I want to avoid investing a lot of effort in coding UI/work flows/database schema etc before I see that it's going to be useful to me (as example of potential user). My idea is stay lightweight and put all the data in text files. So the components could be following:   1. Domain objects are represented by text files or their fragments   2. Domain objects are grouped by their type using directories   3. Structure the files using some both human- and machine-friendly format, e.g. YAML   4. Use some smart text editor (e.g. vim, emacs, rubymine) to edit and navigate those files   5. Use color schemes and macros/custom commands of the text editor to effectively manipulate those files   6. Use scripts (or a lightweight web framework like Sinatra) to try some business logic ideas on top of the data model The question is: **Are there tools or toolkits that support or can be adopted to this approach?** Also any **ideas, links to articles/other knowledge sources** are very welcome. And more specific question: _What is the simplest way to index and update index of files with YAML files_?


How important would a statistics course be to a software developer? More specifically given the description: > 2510 Statistics for Physical Science Students (F) & (W) examines elements of > probability, conditional probability, Bayes' Theorem, discrete random > variables, cumulative distribution function, introduction to continuous > random variables, mathematical expectation, estimation of mean, proportion > and variance, hypothesis testing for one-sample case I'm trying to find out whether I have room to add more CS courses. This course (STAT 2510) is not required, but is "recommended".


Best Traversing Strategy / Logic Help Needed

**Background:** Here is the scenario, imagine I have a little Robot. I give this robot a Map, and I want him to traverse the map, after doing so, I want the Robot to tell me the shortest possible path on the map. So here is an example of a Map: ![Robot Map](http://i.stack.imgur.com/Rs5kd.jpg) **Difficulties:** The Robot is given the Map in the form of a HashMap. For the above map it will be something like this:               A > B, E     B > A, C, E     C > B, E     D > E     E > A, B, C, D, F     F > E      So node [ A ] has neighbours [ B ] and [ E ] and so on. The Robot can only know the neighbours of the node it is currently at. So only when at node [ A ] will the Robot know that the neighbours of [ A ] are [ B ] and [ E ]. The Robot has no way of knowing what neighbours [ B ] has unless it is at [ B ], once there, the Robot can call the **getNeighbouringNodes() method** to find out the neighbours (Returned to Robot as a List). **Current Thinking:** At the moment my logic for getting the shortest path from Start to Exit is as follows: Essentially, it is a breadth first traversal. Once at the start node [ A ], I get the list of neighbouring nodes, then visit first neighbour in the list [ B ]. Once at [ B ] I call the **isThisAnExitNode() method** to check that [ B ] is an exit node, if yes, write my short path, and exist the map. If no, I go back to node [ A ] and grab the next neighbour of [ A ] which is [ E ]. Do same with [ E ], now if no Exit node was found, I move onto [ B ] to explore its neighbours. I think you get the idea. My question is, am I doing it right? Is there a better, more efficient way than my method of traversal? Any help would be greatly appreciated. Thank You.


How to display in compositional relationship that the item knows about the container?

I'm drawing a class diagram and noticed that sometimes I got a relationship (composition or aggregation) where the item uses the container, and sometimes not. **What is the visual difference in a composition where the item class uses the container class vs where the item class doesn't know about the container class?**


how to pluralize 'special' terms e.g. class names

Quite often I find myself referring in text to objects which have strict naming conventions e.g. Java objects, processes, services. I find myself in a dilemma over how to pluralize these names. It seems wrong to pollute the meaningful name by adding an 's' - or worse, a plural that modifies the rest of the name like SomethingUtility -> SomethingUtilities. What if someone does a text search looking for the name? Or cuts and pastes from my comment to search through a log file? I have sometimes resorted to an ungrammatical apostrophe, but this can confuse plural with ownership. Is there any better solution?


When developing a plugin or a standalone software app can I include in its name the name of the host application?

I am making a commercial software product and I want to publish it soon. In my product title can I have words like Photoshop, Visual Studio, Delphi, etc? For example, a full name would be something like: "My product for Photoshop ver 123" or "My Product for Delphi 123".


How to guide stakeholder(s) not to get far from the scrum vision?

Consider this scenario: Stakeholder(s): Let's build a web application to manage user's financial data. Scrum team: Ok, let's do it. . . . **After 3 sprints** Stakeholder(s): Let's also implement a mailing system, so that when user's financial status is not good, (s)he would be warned. Scrum team: Ok, it's not that hard. We'll do it. . . . **After 5 sprints** Stakholder(s): Let's become a mailing provider. Here, how should scrum team guide stakeholder to stay inside the scope of scrum vision? Maybe a more fundamental question is, should the at all? **Update:** Of course there is a product owner. But by scrum team I meant PO, SM, and Team.


Storing a WCF endpoint in the registry - worried about security

I am storing my wcf endpoint in the registry, and using that whenever my app starts up to instantiate a wcf derived object. The user can change the endpoint location, to another server, and the registry gets updated. I am worried about security... lets say a malicious user updates my registry key that is set, and this will cause the client app to make a connection to who knows where... What are the best practices involved here, for what I am doing?


Crowd movements with Python

I've done a program in order to calculate the time required to evacuate a room. The program takes in arguments the number of people (N), the dimensions of the room (L,l), and the location of the exit door. People are represented by 1, and free places by 0. At each step, people can move of one square. There is a counter which counts the number of steps. However, sometimes I get a number of steps which is less than the number of people. And normally, maximum one person can go out by step. Where is the mistake ? Thank you.               def evacuation(N,L,l,iporte,jporte):      a=np.zeros((L,l),dtype=int)           Z=np.sum(a)                           for h in range(N):         ir=rd.randint(0,L)         jr=rd.randint(0,l)         while (a[ir,jr]==1):             ir=rd.randint(0,L)             jr=rd.randint(0,l)         a[ir,jr]=1     A=0     for i in range(L):         for j in range(l):             if a[i,j]==1:                 A=A+1     count=0     run=True     while run:                     #print (a)                     count=count+1                     a[iporte,jporte]=0                     for i in range(L):                         for j in range(l):                             if a[i,j]==1:                                 d=np.ones(4)*10000                                 if i >=0 and i +1 <= L and j >=0 and j+1 <= l:                                                              if i >0 and a[i-1,j]==0:                                         d[0]=np.sqrt((i-1-iporte)**2+(j-jporte )**2)                                     if i <L-1 and a[i+1,j]==0:                                         d [1]= np.sqrt((i+1-iporte )**2+(j-jporte )**2)                                     if j >0 and a[i,j-1]==0:                                         d [2]= np.sqrt((i-iporte)**2+(j-1-jporte)**2)                                     if j <l-1 and a[i,j+1]==0:                                         d [3]= np.sqrt((i-iporte )**2+(j+1-jporte)**2)                                 dmin=min(d)                                 kmin=[]                                 for k in range(4):                                     if d[k]==dmin:                                         kmin.append(k)                                 if len(kmin)==2:                                     b=rd.randint(0,2)                                     if b==0:                                         kmin=kmin[0]                                     if b==1:                                         kmin=kmin[1]                                 else:                                     kmin=kmin[0]                                 if kmin==0 and i>0 and a[i-1,j]!=2:                                     a[i-1,j]=3                                     a[i,j]=0                                 if kmin==1 and i<L-1 and a[i+1,j]!=2:                                     a[i+1,j]=3                                     a[i,j]=0                                 if kmin==2 and j>0 and a[i,j-1]!=2:                                     a[i,j-1]=3                                     a[i,j]=0                                 if kmin==3 and j<l-1 and a[i,j+1]!=2:                                     a[i,j+1]=3                                     a[i,j]=0                             if a[i,j]==2:                                 a[i,j]=2                             if a[i,j]==0:                                 a[i,j]=0                     for i in range(L):                         for j in range(l):                             if a[i,j]==3:                                 a[i,j]=1                     m=0                     for i in range(L):                         for j in range(l):                             m=m+a[i,j]                     if m==Z:                         run=False     return count


Why are these seemingly unnecessary merges happening in git?

Consider this screenshot from our development repository: ![Branching](http://i.stack.imgur.com/SXGpq.png) We are relatively new to git, so things are still somewhat confusing. The question at hand: If you take a look at the commits by me at the very top; are confusing to us. Why do I need to merge something if I didn't even branch anything? I commited the `adjust buildpath` commit, and after that, git immediately made me do a merge. but with what? The `invitation` branch is not interesting for me, and I never touched it in any way. Where did this `anonymous` blue branch come from and why? My colleague (blue avatar) only works in the `invitation` branch currently. Can someone explain to me why this is happening in git-layman terms (as I said, we are new to this)?


Best Practices For Temporary Scripts (Python)

I am running two separate programs which are similar enough that they share a lot of code. I run these programs often and after I evaluate the output. This is a very fluid process and everytime is different from the last time. Currently I write a script named something like: "temp_evaluate_program_A" and then I will copy it to "temp_evaluate_program_B" and change a few lines, along with writing a lot of code on the fly. Often the code isn't very readable and only parts of it will ever be reused. This seems suboptimal as I get a lot of duplication. What do other people do in these fluid situations where there is scope for sharing code between these related programs and reusing the code over time but the scope is limited.


Best Way to Handle dynamic infograph with javascript?

I've currently been assigned a project to create the following with javascript, you can view the final product here: http://i1245.photobucket.com/albums/gg583/leetpete1994/Infografic- TrafficSources_zpsf50dfa6d.png It's basically my job to take the provided PDF and create a way to dynamically display the data that the image conveys. The data itself is going to be calculated elsewhere, so all I have to worry about is accepting the values for each beaker, and filling them appropriately. My idea right now: Right now my idea is using the canvas. I've created a beaker class, and then made the 5 beakers an instance of the class. This works pretty well, and I'm sitting with a canvas that has 5 empty beakers in the correct place. I've divided each beaker by 100, then I can fill each one correctly the amount of pixels needed to be whatever percent it happens to be, but this is where I run into issues. Each beaker is a different shape, and as each one gets filled the shape changes. Therefore, I'm having a difficult time trying to actually draw in the liquid in the beakers. Secondly, if I do manage to draw the liquid in correctly, it's going to cover details of the beaker. If I did liquid first then beakers it would be the opposite problem. So, is there a better way to go about doing this, or to easily draw the odd shapes onto the canvas? I'm beginning to think using the canvas is not going to be the best way. I know I could just make several images for each at different liquid levels, but I want to avoid using that many images in the final product.


How should developers go about managing complex plural words with ActiveRecord?

I'm playing with `pluralize` at the command line, and it's beginning to scare me. Multiples of _leaf_ is _leafs_ (not _leaves_ ) Multiples of _cactus_ is _cactus_ \- not _cacti_ , or even _cactuses_. _Radius_ becomes _radius_ instead of _radii_ Yet it correctly gets _women_ , _octopi_ , _knives_ , and _errata_ (the finer things in life). As I understand it, ActiveRecord uses the same pluralize method that I'm using. And from my tests, it seems that if made enough tables without thinking, you would eventually run into a problem where you couldn't locate the proper table because you were expecting the plural to be different. Is the conventional recommendation to just test all plurals in the command line, and make a note of what the table will be called? Or do most developers just label something as `uncountable` when it gets fuzzy? Side note- no `ActiveRecord` tag??


Is recursion an instance of being "too clever" when programming?

I've read several books and learned through experience that optimizing code to the point where it is inscrutable, or coming up with an extremely fast but extremely complex solution to a problem is not desirable when working in teams, or even when you're working by yourself and have to understand your clever solution some time later. My question is, should recursion be treated in the same manner? Does the average programmer understand recursion easily and thus one should use it with impunity, or does the average programmer not understand recursion very well and one should stay away from it for the sake of overall team productivity? I know there are simple answers of, "Any programmer who doesn't understand recursion isn't worth a grain of salt, so don't worry about them" but I was wondering if you all had some real world experience you would like to share that would illuminate the issue more than the opinion I just mentioned.


Collaboration between client, web designer, and web developer

I am primarily a Web Developer (back end programming) - but intend to offer a complete service to my clients, from concept, to brand design, photoshop mock- ups and everything else in between. I'm aware that it's a good idea to outsource this design aspect of the project to someone that I trust. My question is more about the process: I imagine that in order for the designer to really grasp what the client wants to create, they would need some sort of interaction. Therefore, does anyone know if it is common to bring both parties into a 3 way discussion? Or is it more common to get all of the info from the client, and then pass it onto the designer, and act as a back and forth middleman? Afterall, I am the designer's client. Any insight into this would be great


What is use of universal character names in identifiers in C++

The C++ standard (I noticed it in the new one, but it did already exist in C++03) specifies universal character names, written as `\uNNNN` and `\UNNNNNNNN` and representing the characters with unicode codepoints `NNNN`/`NNNNNNNN`. This is useful with string literals, especially since explicitly UTF-8, UTF-16 and UCS-4 string literals are also defined. However, the universal character literals are also allowed in identifiers. What is the motivation behind that? The syntax is obviously totally unreadable, the identifiers may be mangled for the linker and it's not like there was any standard function to retrieve symbols by name anyway. So why would anybody actually use an identifier with universal character literals in it? Edit: Since it actually existed in C++03 already, additional question would be whether you actually saw a code that used it?


How can I add the version of a file to the file name with Tortoise-SVN?

I would like to start giving unique names to "cache-able" files - i.e. *.css and *.js - in order to prevent caching, without requiring changes to the web- server settings (as is currently done in IIS). For instance, let's I have a JavaScript file called `global.js`. Going forward I would like it to have the name `global.123.js` when revision 123 is checked in. This would also require the following:   * The previous version of the file - perhaps it was `global.115.js` \- is removed when the file is deployed.   * All references to the file are updated with the new file name How do I go about doing this? What concerns do I need to consider?


What Design Pattern is separating transform converters

For converting a **Java object model** into **XML** I am using the following design: For **different types** of objects (e.g. primitive types, collections, null, etc.) I define each its own **converter** , which acts appropriate with respect to the given type. This way it can easily extended without adding code to a huge if-else-then construct. The converters are chosen by a method which tests whether the object is **convertable** at all and by using a priority ordering. The priority ordering is important so let's say a `List` is not converted by the POJO converter, even though it is convertable as such it would be more appropriate to use the collection converter. **What design pattern is that?** I can only think of a similarity to the command pattern.


Changing the license in a fork from GPL to GPL compatible?

I have forked a project that was released under the GPL and made substantial modifications, however there are still some parts and general ideas that are the same as upstream. Due to user interest I am wondering how, if at all, I can relicense the project. Another developer and I have attempted to reach the upstream dev multiple times but he has never responded. Since there hasn't been updates in several years I'm considering the upstream project abandoned and looking at other options. GNU lists Apache and Modified BSD as GPL compatible, which are 2 licenses that come up often and are less "viral" than the GPL. Since they are compatible can I Just relicense my project with either of those licenses? If I am unable to do that, are there any options I have to change the license? It's important because there are several users who have software that is incompatible with the GPL, and therefore makes it impossible for them to adopt the project. I'm trying to avoid simply rewriting everything, which is hard since there's only a handful of good (or correct) ways to accomplish the project goals and I'd end up splitting hairs on what constitutes "derivative" code.


Is this a good measure of PHP script usage of the system?

I've been trying to see a way to get a measure of how much a PHP script costs of memory to the server. Well, I've found some solutions out there that requires some software to make tests and even require to install something on the server. Those solutions are not what I'm looking for, as I just want a simple measure of the consumption. My try was to do the following:               <?php          $initialMem = memory_get_usage();          /* Script comes here */          $finalMem = memory_get_usage();          echo ($finalMem - $initialMem)/1024 . " Kbytes";     ?>      Where I divided by 1024 to convert from bytes to kilobytes. The idea was that the function memory_get_usage() gets the amount of memory allocated for the execution of the script and so I thought that taking the difference would be a good measure of the usage. Is this correct? Is the difference between those values a good measure of the usage of memory by the script? If not, how can I get a good measure of this usage without having to install anything on the server?


MVP Pattern Philsophical Question - Security Checking in UI

I have a philosophical question about the MVP pattern: I have a component that checks whether a user has access to a certain privilege. This privilege turns on or off certain UI features. For instance, suppose you have a UI grid, and for each row that gets bound, I do a security check to see if certain features in the grid should be enabled or disabled. There are two ways to do this: have the UI/view call the component's method, determine if it has access, and enable/disable or show/hide. The other is have the view fire an event to the presenter, have the presenter do the check and return the access back down to the view through the model or through the event arg. As per the MVP pattern, which component should security checks fit into, the presenter or the view? Since the view is using it to determine its accessibility, it seems more fitting in the view, but it is doing database checks and all inside this business component, and there is business logic there, so I can see the reverse argument too. Thoughts?


What should a test method test?

Suppose we're unit testing a class with xUnit-like framework - so a test class is created for class-under-test. Now, how much should be tested by individual test methods? Should there be one-to-one mapping between methods-under-test and test methods:               class TestMath {              testSqrt() {             assertEquals(Math.sqrt(4), 2);                  assertException(Math.sqrt(-2));         }     }      Or is it better to have one test method per "scenario":               class TestMath {              testSqrtOfPositiveNum() {             assertEquals(Math.sqrt(4), 2);         }              testSqrtOfNegativeNum() {             assertException(Math.sqrt(-2));         }     }      Which is better and what are pros and cons of both methods?


What does "if w in [1..5, 8, 11]" mean in pseudo code?

In some pseudocode, I saw the following:               if w in [1..5,8,11]      Does it mean that if w is from 1 to 5 or 8 or 11? Or is it something else?


In what way is JavaScript (ECMAScript) similar to Self and Scheme

When looking at the ECMAScript 4th Edition specification here it mentions that > ES3 is a simple, highly dynamic, object-based language that takes its major > ideas from the languages Self and Scheme. I'm not familiar with these two languages and cannot seem to find any mention of what exactly is similar to these languages in ECMAScript. Would someone be able to explain to me the features that ECMAScript has taken from these languages?


What are the best resources for learning TDD?

I want to learn (and master) TDD. What are the best:   * books   * websites   * videos    * list of exercises   * personal words of wisdom for learning, appreciating, and using TDD?


What attracts software developers such as yourselves to choose to program for the Android mobile platform?

Dear programmers, as part of my final year university project, I am conducting research into what makes programmers prefer to program for Android as opposed to other mobile operating systems. The description does not need to be detailed however, I am trying to find patterns between programmers to determine what properties (other than money) a software company such as Android must have in order to attract programmers and therefore grow.


Are there any Clojure libraries for p2p?

I'm a web developer, but lately I have been learning Clojure and now I'm interested in creating a p2p application. And since Clojure is a general purpose language, I guess I can just use that. Any suggestions?


SOLID vs. Avoiding Premature Abstraction

I understand what SOLID is supposed to accomplish and use it regularly in situations where modularity is important and its goals are clearly useful. However, two things prevent me from applying it consistently across my codebase:   * I want to avoid premature abstraction. In my experience drawing abstraction lines without concrete use cases (the kind that exist now or in the _foreseeable_ future) leads to them being drawn in the wrong places. When I try to modify such code, the abstraction lines get in the way rather than helping. Therefore, I tend to err on the side of not drawing any abstraction lines until I have a good idea of where they would be useful.   * I find it hard to justify increasing modularity for its own sake if it makes my code more verbose, harder to understand, etc. and doesn't eliminate any duplication. I find simple, tightly coupled procedural or God object code is sometimes easier to understand than very well-factored ravioli code because the flow is simple and linear. It's also much easier to write. On the other hand, this mindset often leads to God objects. I generally refactor these conservatively, adding clear abstraction lines only when I see clear patterns emerging. What, if anything, is wrong with God objects and tightly coupled code if you don't clearly need more modularity, don't have significant duplication and the code is readable? EDIT: As far as individual SOLID principles, I meant to emphasize that Liskov Substitution is IMHO a formalization of common sense and should be applied everywhere, since abstractions make no sense if it isn't. Also, every class should have a single responsibility at some level of abstraction, though it may be a very high level with the implementation details all crammed into one huge 2,000 line class. Basically, your abstractions should make sense where you choose to abstract. The principles I question in cases where modularity isn't clearly useful are open-closed, interface segregation and especially dependency inversion, since these are about modularity, not just having abstractions make sense.


Dependent Object Serialization

What's the recommended way to serialize dependent objects, especially when objects are being freshly constructed (to avoid malicious byte streams, or whatever)? For example.... After creating a (genericized, but setup through Spring for my company) fiscal calendar based on JodaTime, I'm creating the next version based on JSR310 (using the back-port for development) in preparation for Java 8. Currently, I'm working through serialization; how am I supposed to serialize dependent objects? Most of the existing stuff has a 'single' chronology, but I don't get to rely on that (for instance, the fiscal year can start on any day during the ISO year, which means a new FiscalChronology). Something like this:               public class FiscalDate implements Serializable {         private final long epochDays;         private final FiscalChronology chronology;              // Many of the other 'date' instances also have a reference to their 'era':         private final transient FiscalEra era;     }          public class FiscalChronology implements Serializable {         // These two control year/month patterns.         private final YearPattern yearPattern;         private final MonthPattern monthPattern;         // This should be derived during deserialization, for safety reasons.         private transient final FiscalEra[] eras;              private Object readResolve() {             return FiscalChronology.create(yearPattern, monthPattern);         }     }      What do I do for the 'derived' era?               public class FiscalEra implements Serializable {         // So that eras can be singletons, per JSR310 documentation/recommendations.         private static final ConcurrentHashMap<FiscalChronology, FiscalEra[]>;              private final int eraValue;         private final FiscalChronology chronology;              public static FiscalEra of(FiscalChronology chronology, int era) {             return putIfAbsent(chronology, makeEras(chronology))[era];         }     }      Should I just remove serialization? Only serialize `eraValue` (and rely on the serialization graph including the Chronology on its own)? * * * # EDIT: Related to this, what am I supposed to do for the output of `toString()` \- should it just be the name of the era (which I'm linking to the ISO eras), and expect people to include chronology information if it's important, or always include information about the chronology?


Should I keep using the normal mysql_query or switch to PDO interface in php?

I'm building a big website, and using the normal old `mysql_query` method for transactions and communications with the database, and everything i going fine, including security. I'm a little bit confused, should I switch to the new PDO interface? cause I learnt that's safer, or keep using the old `mysql_query()` and `mysql_fetch_assoc()` methods? I'm very close to completing the website, and to switch to the `PDO` interface will cost me time, to start updating my codes. I'm a little confused, **which should I use and what are the pros and cons?**


Difference between a CMS and a Web Development Framework

The web world is flooded with CMSes. Some tout their CMS as Web Development Framework. Some say it as Content Management Solution and nowadays i m hearing Content Management Framerowk. When we hear "Framework", it sort of sounds like more complex and sophisticated. Is there any specific difference between these two i.e. CMS and Web Development Framework? Or Is it that a Web Development Framework can be a CMS and vice versa? Thanks


Idiomatic Javascript code architecture

I am writing a node.js application which I am breaking down into modules, the issue is I am not sure how to organise my code in an idiomatic Javascript way. Currently each of my modules exposes a set of functions that are intended to be called directly. All state is modified by the module with the gameId being the first parameter :               //snip         var gameId = gameModule.createGame();         // Return the gameId down to a remote client         client.send(gameId);     }     // When a remote client wants to add a player         gameModule.addPlayer(gameId, "Player 1");     }      An alternative approach would be to actually use objects e.g. :               //snip     var game = new gameModule.Game();     // Return the gameId down to a remote client     client.send(game.getId());     }     //snip     // When a remote client wants to add a player     var gameToModify = gameModule.getGame(gameId);     gameToModify.addPlayer("Player 1");     gameModule.saveGame(gameToModify);      My question is to any Javascript programmers (or regular ones) is which of the two above alternatives looks easiest to work with / most natural?


Inspiring problems to show off the importance of regular expressions?

I am planning to give a presentation/demonstration on regular expressions at work to encourage young developers to add this powerful and important tool in their toolbox. Just teaching syntax doesn't cut it. I often see people say nice. After the presentation, they get on with their programming lives without ever thinking of using it mostly. I am raking my grey matter to come up with some solid examples, not just problems that matches 'cat' and 'cut'. I missed to note down the occasions of my regex enlightenments to use here. :^( Do you have some inspiring problems to share that could be solved with regex? Update: Wow! I didn't expect so many wonderful answers. Thank you. For now, I will mark @tdammers' answer as accepted. Bring those regex memories keep coming :-)


Multi-lingual error messages and error numbers

So we're looking at the possibility of porting our software to support multiple languages and one of the areas we're going to have to deal with is error messages and other notifications. These obviously have to be reported to the users in their own language. Our team (largely) only speak English and even if we were all multi-lingual we're looking at selling to a wide range of countries and could never expect to have a reasonable number of people speaking all languages (we're a small company). The obvious way to get round the language issue when errors or other messages we may get asked about which are being reported is error numbers which would be consistent across language. While these are going to exist in the backend (if only as key on the error message), I'd really rather not throw them at users if we don't have to but I don't have any other solution. Anyone have any useful suggestions for alternatives?


Are there any language agnostic unit testing frameworks?

I have always been skeptical of rewriting working code - porting code is no exception to this. However, with the advent of TDD and automated testing it is much more reasonable to rewrite and refactor code. Does anyone know if there is a TDD tool that can be used for porting old code? Ideally you could do the following:   1. Write up language agnostic unit tests for the old code that pass (or fail if you find bugs!).   2. Run unit tests on your other code base that fail.   3. Write code in your new language that passes the tests without looking at the old code. The alternative would be to split step 1 into "Write up unit tests in language 1" and "Port unit tests to language 2", which significantly increases effort required and is difficult to justify if the old code base is going to stop being maintained after the port (that is, you don't get the benefit of continuous integration on this code base). EDIT: It's worth noting this question on StackOverflow.


Do development standards vary by city?

I'm a .Net C# developer who got most of my experience working for a government office in DC. There, it was relatively easy to find a job. I would put my resume out, and in no more than a month I would have an offer. I now live in Seattle, and a 2-month job search full of in-person interviews returns the same output: "We like your personal skills and you're a good team fit, but your coding is not up to par with our standards." I have 2 theories as to why this might be: 1) Most development jobs in DC are for support of low-level administrative applications. Just so long as 20-30 people can use it without problems, it's a good product. However, most development in Seattle is done for real companies who develop real products used by a wide array of customers... and HAS to be up to tighter development standards. 2) (This one is probably more obvious) I'm searching for jobs that match what I made in DC. Since the cost of living is lower here, that means I'm setting my bar to a more Senior level, which is working against me. Does this at all make sense to anyone else? Does anyone else find this kind of variance between being a developer in contrasting areas? ...or am I just trippin'? lol


Is there a standard for naming the parts of a file path?

For example:               /path/to/file.zip     # absolute path     /path/to/             # path     file.zip              # file name      I can't seem to find a standard on naming the parts of a path anywhere...


Is 100% code coverage a pipe dream?

Is it feasible to expect 100% code coverage in heavy jquery/backbonejs web applications? Is it reasonable to fail a sprint due to 100% coverage not being met when actual code coverage hovers around 92%-95% in javascript/jquery?


Truly useful UML diagrams

UML has a _jungle_ of Diagrams.   Profile Diagrams, Class Diagrams, Package Diagrams... ![enter image description here](http://i.stack.imgur.com/8tmN9.jpg) However, (IMH-and-not-too-experienced-O) I quite see that doing each and every diagram is overkill. Therefore, which UML Diagrams are more suitable in a web context, more expecificly a blog (we want to build it from scratchs). I understand that just because I used UML Diagrams does not imply that our code would be great and brilliant... but, it certainly would be better than just unplanified code...


How do you approach learning a framework?

When you need to learn a framework, what steps do you take to learning it? Do you have a specific methodology to learning a framework?


Did anyone else get a deeper understanding about pointers when learning linked lists?

I'm a student at the University and I'm taking the Data Structures class. When learning linked lists and doubly linked lists, did you guys feel you learned a deeper understanding of pointers, dynamic memory allocation, and memory usage? I just created my first linked list(it was actually a doubly linked list) and it seemed to me like a real eye opener. Your thoughts?


Selecting the (right?) application design

While working to build software products for early stage startups, I have seen two very common schools of thought that define an approach to application design. Those 2 paradigms typically include designing an application predicated on an "extendible codebase” or a "throw away codebase". What factors should one consider/measure to identify their approach to application design? What are alternatively ways to think about application design? Some factors suggested to date include:   * the amount of time available to build the product.    * the total amount of budget available.    * the level of quality.


I'm tasked with leading the documentation effort for an existing, entirely undocumented, software product - what resources are there to help me?

I'm a software developer at a technology company. I have been tasked with leading the documentation effort for the product I work on. The goal is to produce documentation internal to developer, and the project spills over into the business side, where it covers requirements documentation. This project is challenging. Specifically, I'm dealing with a product which: \- has been around for a long time, at least 6 years. \- has no form of documentation other than some small, outdated pieces here and there. \- has comments in the code, but they are technical and do not convey any over- arching behavior (even on technical side). \- as a consequence of having little to no documentation, is often unnecessarily complex under the covers In addition, we have not been given a lot of time to work on this project. I do not have any formal documentation or writing background, training, or experience. I have displayed some ability in writing/communication around the office, which may be why I was assigned to this project. Please share your advice or recommendation for resources to help me prepare and deal with this project. I'm looking for references to books/website/forums/whatever, to help me come up with the design of a plan with milestones, learn about best practices, task delegation, templates, buy- in, etc. I'm hoping specifically for resources targeting or giving special mention of introducing good documentation to **existing, undocumented, projects**.


Bug fixing appproach

I have been working on a project comprising of databases, and I recently received a bug report for the remote execution of some queries. Usually, you try to find out the actual cause for the bug to occur and then fix it.   But sometimes what I do when I'm fed up of doing some research (and can't find suitable information on the internet) is just change the logic, which takes me much less time compared to the other option. Is this approach correct, or should I try to fix the original bug involving more R&D?


Using JSTestdriver to test UI/DOM?

Can JSTestDriver be used to test DOM behaviors and interactions? I see I can write tests to exercise pure JS but how do I go about testing against HTML or DOM? Can I deliver with each test HTML for browsers to render and the tests to run against?


Is this a valid example of a dangling pointer?

The book "Data Structures in C" (Horowitz and Sahni) suggests that in the following code the pointer pf is behaving as a dangling reference:               float f,*pf;     pf=(float*) malloc(sizeof(float));     *pf=2.6;     pf=(float*) malloc(sizeof(float));      The reasoning they give is that after the last line there is no way to retrieve the storage in which 2.6 was stored. However, wikipedia defines a dangling pointer as               Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type      In the code above pf does not satisfy that definition - it points to a valid object of appropriate type. Is pf a dangling pointer, or something else?


Do customers/clients care about MVC or web forms?

I have a plan to start a small business soon. It is going to be a type of freelancing to build websites and applications using ASP.NET. I want to focus on one thing Web forms or MVC. However, I have no idea if that has any importance to the client. I mean do the clients know about MVC or web forms? Do they prefer one of them?


What is the hardest bug to find?

If possible write how to avoid this kind of bug (besides testing, of course, please write a specific technique)


Is the creator of a piece of software bound by the license he gives it?

For example, if a person creates an application that they open-source under a license that says you can use this code but you cannot sell it, has that person just bound himself to not selling it now as well?


How to implement child-parent aggregation link in C++?

Suppose that I have   * three classes `P`, `C1`, `C2`,   * composition (strong aggregation) relations between `P <>- C1` and `P <>- C2`, i.e. every instance of `P` contains an instance of `C1` and an instance of `C2`, which are destroyed when the parent `P` instance is destroyed.   * an association relation between instances of `C1` and `C2` (not necessarily between children of the same `P`). To implement this, in C++ I normally   * define three classes `P`, `C1`, `C2`,   * define two member variables of `P` of type `boost::shared_ptr<C1>`, `boost::shared_ptr<C2>`, and initialize them with newly created objects in `P`'s constructor,   * implement the relation between `C1` and `C2` using a `boost::weak_ptr<C2>` member variable in `C1` and a `boost::weak_ptr<C1>` member variable in `C2` that can be set later via appropriate methods, when the relation is established. Now, I also would like to have a link from each `C1` and `C2` object to its `P` parent object. What is a good way to implement this? My current idea is to use a simple **constant** raw pointer (`P * const`) that is set from the constructor of `P` (which, in turn, calls the constructors of `C1` and `C2`), i.e. something like:               class C1     {       public:         C1(P * const p, ...)         : paren(p)         {         ...         }            private:         P * const parent;         ...     };          class P     {       public:         P(...)         : childC1(new C1(this, ...))         ...         {             ...         }            private:         boost::shared_ptr<C1> childC1;         ...     };      Honestly I see no risk in using a **private constant** raw pointer in this way but I know that raw pointers are often frowned upon in C++ so I was wondering if there is an alternative solution.


Why would an employer ask for a 'long' code sample?

What would a large project that spanned multiple files and >1000 lines show to an employer that a few individual files and a couple hundred lines couldn't capture?


Is an 'if password == XXXXXXX' enough for minimum security?

If I create a login for an app that has middle to low security risk (in other words, its not a banking app or anything), is it acceptable for me to verify a password entered by the user by just saying something like:               if(enteredPassword == verifiedPassword)          SendToRestrictedArea();     else          DisplayPasswordUnknownMessage();      It seems to easy to be effective, but I certainly would not mind if that was all that was required. Is a simple check on username/password combo enough? **Update:** The particular project happens to be a web service, the verification is entirely server side, and it is not open-source. Does the domain change how you would deal with this?


Why are marketing employees, product managers, etc. deserving of their own office, yet programmers are jammed in a room as many as possible?

I don't understand why many (many) companies treat software developers like they are assembly line workers making widgets. Joel Spolsky has a great example of the problems this creates: > With programmers, it's especially hard. Productivity depends on being able > to juggle a lot of little details in short term memory all at once. Any kind > of interruption can cause these details to come crashing down. When you > resume work, you can't remember any of the details (like local variable > names you were using, or where you were up to in implementing that search > algorithm) and you have to keep looking these things up, which slows you > down a lot until you get back up to speed. > > Here's the simple algebra. Let's say (as the evidence seems to suggest) that > if we interrupt a programmer, even for a minute, we're really blowing away > 15 minutes of productivity. For this example, lets put two programmers, Jeff > and Mutt, in open cubicles next to each other in a standard Dilbert veal- > fattening farm. Mutt can't remember the name of the Unicode version of the > strcpy function. He could look it up, which takes 30 seconds, or he could > ask Jeff, which takes 15 seconds. Since he's sitting right next to Jeff, he > asks Jeff. Jeff gets distracted and loses 15 minutes of productivity (to > save Mutt 15 seconds). > > Now let's move them into separate offices with walls and doors. Now when > Mutt can't remember the name of that function, he could look it up, which > still takes 30 seconds, or he could ask Jeff, which now takes 45 seconds and > involves standing up (not an easy task given the average physical fitness of > programmers!). So he looks it up. So now Mutt loses 30 seconds of > productivity, but we save 15 minutes for Jeff. Ahhh! Quote Link More Spolsky on Offices Why don't managers and owner's see this?


How can I avoid concurrent access in PostgreSQL?

I would like to have your opinion, how I can handle the case when PDO engine and Hibernate engine "talk" to the same db? There is a PHP application as frontend, and a Java doing some job after user through PHP says so. So can we avoid concurrent access to same records? And not have problems? The database is PostgreSQL.


Question between aggregations, compositions, references (arrow) and simple link (nothing) relations within UML2?

I have some questions regarding relations between aggregations, compositions, references (arrow) and simple link (nothing) relations within UML2 ?   1. If A -> B -> C each have composition relationship. Are the root responsable of creation and destruction of the object B and C ?   2. What aggregations have that the simple link or references doesn't ? What make them different ? Thanks. Edit: The question was a bit unclear and not objective. I edited it.


Architectural Composition Languages

Recently stumbled upon this paper (PDF) talking about ACLs, or Architectural Composition Languages. They're a fusion of two earlier lines of research: Architectural Definition Languages (such as UML) and Object Composition Languages (such as XAML, WWF, or scripting languages). The goal of an ACL is to have a high-level description of a program's architecture which can also be compiled into a runnable program. The high- level description assists automated analysis, while the 'executability' means changes can be tested immediately. You would still author the components of the program in a conventional programming language (C, Java, Python, etc), but they would be _composed_ into a complete program by the ACL. One of the expected benefits is that a program can be ported to a different platform by swapping in "similar but different" components. I've been hankering for something like this for a long time (see this answer I gave on a StackOverflow question a few years ago). The paper mentions that the researchers were working on a language called ACL/1 that initially targeted Java, but would be ported to support .Net as well. However, I can't find any more mention of ACL/1 anywhere. Has there been any more work done on this? Are there any other implementations of the ACL concept that are available for use or experimentation?


How can programming ability be used to help people in poverty?

As a student studying Computer Science in college, I often hear from friends working on various humanitarian projects, and I want to do something myself. But it seems that programmers don't have as many obvious avenues to help out as, say, doctors or teachers. What are some ways in which programmers can put their talent to use for people in poverty?


In what order do people build websites?

For a website, you need to have an idea, you need to have a design and you need to have data, events and output, right? Whether it be a blog, web app, Q&A site, search engine... Anyway, that is only slightly related to my question. My question is, when designing a website, providing I know the purpose, what should I start with? Should I start with the CSS, design and look&feel using dummy data first, or should I program in the logic, events and output, and style it later? What is the design process of most websites that are built from the ground up?


Is there a point to writing in C or C++ instead of C# without knowing specifically what would make a program faster?

I wrote a small library in Python for handling the xbox 360's STFS files to be used on my web applications. I would like to rewrite it for use in the many desktop programs people are writing for 360 game modding, but I'm not quite if I should continue using C# or delve into C++ or even C. STFS is an in-file file system used by the xbox 360 and the job of the library would be extracting/injecting files, which could take noticeable amounts of time to do. What I know in C# comes from internet tutorials and resources, as would anything I learn about C++, so what I'm asking is if it's better to bring myself to a slightly lower-level language without knowing beforehand the features of the language that increase performance, or continue assuming that compiler optimizations and that my lack of experience will mean that the language I choose won't matter.


Good examples for teaching software estimation (size, schedule, effort)?

I'm going to be teaching a class that covers a broad brush of estimation techniques. I intend to cover absolute estimation techniques based on SLOC (e.g. Function Points, COCOMO II etc.) and relativistic ones like T-shirt sizing, story-point estimation etc. I was wondering what would be some good exercises to conduct in class to help understand the what, why and how of estimation. I hope to pique their interest with actual hands-on examples rather than _death by powerpoint_. An example that was suggested by a colleague of mine was to bring a newspaper to class and ask them to estimate the number of words in the paper (for short papers or just a page for long ones). Since they can't absolutely count it, they'll be forced to come up with their own heuristics and they to take the lecture from there to help them gain insights into their own _estimation technique_. Although a good example, it doesn't seem to link well with software estimation IMHO. I was wondering what would be some good examples for teaching software estimation w.r.t. size, schedule and effort estimations that they'll encounter in practice. I prefer practical examples that I can actually 'conduct in class' rather than 'just talk about it'. **UPDATE** : To throw some more light on the structure of the class - Yes, I'll be covering the aspects of granularity i.e. at the RFP stage what's the best one could do. How can the estimate be refined when more is known about the problem (e.g. FPs after prototyping is done) and how story-points can be useful once you have a list of stories to go by Or how COCOMO like models based on SLOC count can be applied post architecture/design. I.e. narrowing the cone of uncertainty as you progress towards completion of the project. My aim is to elicit examples that the student teams can practice in class to get a better feel for the techniques and understand its ease of use (or difficulty) and the level of accuracy that can be obtained at that level of granularity and knowledge. **PS** : If you are downvoting, I'd appreciate a comment highlighting the same. This is not a subjective question and rather non-trivial to teach in a hands-on manner and does have the possibility of selecting the 'best answer'


Where can I get the code I write on my own for practice evaluated?

I am a fresher. My job is not very demanding of me when it comes to exercising my programming prowess. So, I have started to write code on my own (a simple space invasion program, chat application, etc). I will be completing some of these in a few weeks, but what i am worried about is how I shall get my code evaluated/criticised . I am new and they say it takes years to become a good programmer, so obviously I am making mistakes. But who can tell me what mistakes I am making? The amount of code that I write at my company and gets checked or revised by senior developers is too small to make any significant impact on my career. Please help.


Is a module allowed to make implicit assumptions?

I use .Net and C#. I have the following code in some module:               DateTime validFrom = Convert.ToDateTime(validFromTxt.Text);      This makes (in my opinion) the implicit assumptions   * that there is text in validFromTxt.Text   * that it is possible to convert this into type DateTime. My question is, may the module make these implicit assumptions (due to "knowledge" of context of the page) or would it be better to check them before the command?


How can a server side language span many servers?

I would like to ask you as experts about PHP, ASP.NET/C#, Python or any other server side language. How do they span multiple servers? When I see a big website and look how many dedicated servers it uses, at least it uses 10 servers. I sit and think how the langauge that was used in building this site span these servers? Is there something in the language itself or its architecture that make it able to go with this **and is there some language that are better than others regarding this?** **Edit:** But I see many ASP.NET and PHP powered sites that are on many servers, in this case how can the same programmed site be on server 1, on server 2, etc. Does **Server 1** contain some functionality for example and **Server 2** contain others? Or do they just progrm the site and the hosting company makes balance between these servers?


Correct alignment when outcommenting code

Suppose I have some code               void some_block(void)     {         some_statement_1();         some_statement_2();         some_statement_3();     }      Now I wish to out-comment statement #2, but here I never can find a way where it feels right. Usually I will do the following:               void some_block(void)     {         some_statement_1();     //    some_statement_2();         some_statement_3();     }      But now we got what looks like extra indentation of statement #2, yet it is arguable whether the indentation is still "correct". Alternatively we could do:               void some_block(void)     {         some_statement_1();         //some_statement_2();         some_statement_3();     }      This looks a bit better, yet still somehow also wrong. However the following just looks misplaced:               void some_block(void)     {         some_statement_1();       //some_statement_2();         some_statement_3();     }      How do you outcomment code and keep "correct" indentation? **Update** It seems most people who have provided answers did not answer my question, but simply state that it is bad practice to leave dead code around. While I completely agree with that, that was not the point of the question. Right now I am facing a case of example where I have 5 helper functions, that manage 5 similar but slightly different structs for me. I use these helper functions to make my code easier to read. But, at the moment (and for the next month probably) one of the structs are not going to be used. And I cannot commit anything which causes compiler warnings, so I have to outcomment that part of the code and commit it like that. Also I forgot this last variant, which I think just looks plain wrong:               void some_block(void)     {         some_statement_1();     //  some_statement_2();         some_statement_3();     }


"Generators are function derivatives"

I am reading this article on a new feature of ECMAscript 6, generators, that are landing in the V8 JavaScript interpreter. Not too far from the top, the author suggests an analogy: > generators are like functions, with their bodies taken to the first > derivative. Calling `next` integrates between two `yield` points. I really like this analogy. Has this analogy already been discussed in the literature? Are there similar ones? Does it fit within a bigger framework of analogies? (I made a quick Google search but that was not helpful.)


Finding the right license for my open source

I'm about to create a new open-source project and I'm not sure about the licensing method I should choose. Here is what I know:   * The project will be built on the basis of an already existing open source. I will fork from the original project and will build a community around a new project that has a code base from the original project.   * In case the new project becomes successful, I will want to, one day, fork to an extended version of it which I will earn from. I want the non-free version to be non open-source. For now, I have 2 main projects that I can use as my base project. One has a GPL license and the second has MIT license. I'm wondering what would better suit my needs. Also I'm wondering which license should I use for my open- source in order to, maybe, someday fork for a paid version which will not be open-sourced?


Beginner Trying to Understand Existing Project

I have a project that requires me to control movement of SCARA robot using VC. I am a beginner in programming so I thought of using existing program as my reference. The SCARA robot that I am using is regarded as a valuable property of the department and must be operated with extra care. I cannot simply make a program out of nowhere to ensure no damage on the robot. I find it difficult to understand the existing program and am overwhelmed with the long lines of coding. Unfortunately, the last person involved with the program already left and no one in my department has any experience with the program. Currently I am not getting the help that i really need.Hopefully someone can give me guidance on this project.


What to do when you cannot renegotiate a certain software design?

Well, I have a certain dispute with a colleague of mine. We have a software design where we build all of our widgets server side and send them client side as html. Most of the time it's better and easier to control and add stuff to. But sometimes it just is not that good; it makes the client side act "retarded" regarding the situation at hand. Another major flaw is that it gets really slow for unapparent reasons. So what would you do in this case? **Edit:** When I say "retarded" I mean the client side is not aware of any changes made by the server side, it just gets a string of functions it supposed to call to if something goes wrong with loading one of the resources that is passed from the server side(f.e. an image or another script) the client side is limited when in need to handle the errors. This situations are handled very poorly since the client side does not have a "clear view" of the state at hand. Of course you can handle the situation from the server side(in a twisted way), but then again why bother so much when it is so much more simplified when dividing the rolls.


How can I protect a java app to be deployed in the google chrome app market?

I'm making a java app. Is to solve a problem in engineering. I'm thinking that it would be nice to sell it as an app in the google chrome market, but I'm worried about security. I've been trying to find any info on the subject, but to no avail. Does anybody have any thoughts on this? how secure is the google chrome market? I mean security in the sense that someone downloads your software and uses it -and distribuites it- without permission. I would appreciate any kind of info, be it links to books or personal experiences, whatever. Thanks!


How to deal with system "static" data in java

I was just wondering if there is some better way how to handle system "static" configuration data. Let say you have a system which offers several operation which are in code translated to operation code but you need to keep other related information to that operation like description, priority etc. Nasty way I have seen is public static final constants. Better way I was using before was create a class eg:               public abstract Codebook{     private int id;     private String description;     ... getters setters     }      Then for given cathegory - in this case OperationalCode:               public class OperationalCode extends Codebook{}      Instance of this class were created with the data from BD. Now I cannot use DB so I thought I will create factories which will populate classes with given set of parameters. BUT all is hardcoded to factory class which I don't like. Is there a better solution how to tackle this case as I believe I am not the first one solving that. Some handy framework or ... I wasn't probably clear enough. I am fully aware of Properties capability in java but that doesn't match the criteria. Let me explain more: When I say configuration I mean business configuration. You never know how many possible items you will get. For example in banking system you can cancel contract and you are forced to provide a reason for termination - predefined list which includes text, code in your system and translation to codes of third party systems where your system need to perform cancelation operation as well. Those possibilities need to be externalized of your system as they will probably change offten. Property files doesn't seems as a right choice and the opposite site - using Buisiness Rule Systems (e.g. Drools ) seems to me as overkill. Using enums with specified properties wouldn't fit quit well because time to time you need to be able to recognize that it is configuration and not just normal enum. That the reason for class inheritance - instanceof operator solve this.


Proprietary formats and Open source software

How come open software like OpenOffice.org and supports proprietary formats like Microsoft DOC and MP3? AFAIK, the DOC format is not open and implementing the feature in OO.org required serious amounts of reverse engineering. So why isn't Microsoft (or any such proprietary players) making an issue out of this? In the same light, how come the GStreamer plugins are able to play proprietary formats?


Best algorithm/practice when creating a search mechanism for your database?

I have been designing a database where it is very important to provide users with a good search mechanism. So I was wondering what some of the best practices are for using keywords to search over multiple database tables and return the relevent records? Some other things I am curious about:   * The users location, if they provide an address   * The speed of the algorithm Additional Information: I am using C# and LINQ-To-SQL.


How can I start testing in a testing anticulture?

I have a confession to make: Formalized automated testing was never a part of my programming background. I now work in a very large company with many developers (most of them _web_ developers of one sort or another), and it's apparent that most of them don't test* either. (*I'm not going to keep saying _formally_ ; please infer it.) If I wait to have the support of my organization to begin testing it will never happen. If I try to "change things from the inside" by pushing testing at management I will run out of steam before change happens. I need to start testing now. But with TDD and its ilk I'm going to end up with lots of testing code right along with the production code. Our version control systems (all centralized) aren't organized for storing testing code. I'll have to find a place for all that on my workstation. Is it possible to begin a personal practice of software testing in a culture that doesn't value or provide the tools for it? What techniques and tools do you use to enable you to test when the official tools and organization don't have a place for tests, frameworks and automations?


Is there a common capitalization convention in C++?

I do a lot of work in Python and Java, and both those languages have fairly common (though not universal) conventions on how capitalization should be used in identifiers: both use `PascalCase` for class names and `ALL_CAPS` for "global" constants, but for other identifiers a lot of Java code uses `mixedCase` whereas a lot of Python code uses `underscore_delimiters`. I know that no language or library _enforces_ any particular capitalization, but I've found that when I stick to the standard conventions for the language I'm using, my code seems much more readable. Now I'm starting a project in C++, and I'd like to apply the same idea. Is there any most common convention for capitalization that I should know about?


What are C++/CX and C++/CLI, and how do they relate to C++ and WinRT?

I was considering taking up the challenge of learning C++ for designing Metro apps and that's when I came across C++/CX. Can Metro apps be coded in C++ 11? Do they require C++/CX to work? And what exactly is C++/CX? Is it possible to create a Metro app using only C++, or is C++/CX required? Also, how does C++/CLI tie into this picture?


Java certification - Should I upgrade?

I have Java 1.2 certification which I completed in 2002. Now I have 10 years of Java experience and I tried to catch up with all Java 5/6 new features but at times I am lost in some of the new things especially on multithreading and generics which were revamped in the later releases? Should I re-take the SCJP for Java 6 or Java 7? Any experience on this? Any suggestions?


Why don't computers come with specialized hardware such as sorting networks?

Instead of programming the way we do, why don't we make specifications of common tasks such as "sorting", and then let the environment compile it to make best use of it's hardware? This way, we could ship computer with new specialized hardware such as sorting networks, and it would automatically work with existing code.


Simplified knapsack in PHP

I have two instances where I'd like to display information in a "justified" alignment - but I don't care if the values are switched in order. One example being displaying the usernames of people online: `Anton Brother68 Commissar Dougheater Elflord Foobar Goop Hoo Iee Joo` Rearranging them we could get exactly 22 characters long on each line:               Anton Brother68 Foobar     Commissar Elflord Goop     Dougheater Hoo Iee Joo      This is kind of a knapsack, except seems like there ought to be a P solution since I don't care about perfection, and I have multiple lines. Second instance is identical, except instead of names and character count I would be displaying random images and use their width.


What's the difference between ASP.NET Web Applications and Websites?

Currently, I am reading _Pro ASP.NET 4 in C#_ and in it, two ways of creating a web application are described:   * Website   * Web Application Project In which scenarios should I choose the former over the latter, and vice versa?


Should I stick with or abandon Python to deal with concurrency?

I have a 10K LOC project written in Django with quite a deal of Celery (RabbitMQ) for asynchronicity and background jobs where needed, and have come to the conclusion that parts of the system would benefit from being rewritten in _something_ other than Django for better concurrency. Reasons include:   * Signals handling and mutable objects. Especially when one signal triggers another, handling them in Django using the ORM can be surprising when instances change or disappear. I want to use some messaging approach where the data passed along doesn't change in a handler (Clojure's copy-on-write approach seems nice, if I got it right).   * Parts of the system are not web-based, and need better support for performing tasks concurrently. For example, the system reads NFC tags, and when one is read an LED goes on for a few seconds (Celery task), a sound is played (other Celery task), and the database is queried (other task). This is implemented as a Django management command, but Django and its ORM being synchronous by nature and sharing memory is limiting (we are thinking of adding more NFC readers, and I don't think that the Django+Celery approach will work any longer, I'd like to see better message-passing capabilities). What are the pros and cons of using something like Twisted or Tornado compared with going for a language such as Erlang or Clojure? I am interested in practical benefits and detriments. > How did you come to the conclusion that some parts of the system would fare > better in another language? Are you suffering performance problems? How > severe are those problems? If it can be faster, is it essential that it is > faster? **Example 1:** Django at work outside an HTTP request:   1. An NFC tag is read.   2. The database (and possibly LDAP) is queried, and we want to do something when data becomes available (red or green light, play a sound). This blocks using the Django ORM, but as long as there are Celery workers available it doesn't matter. May be a problem with more stations. **Example 2:** “message-passing” using Django signals:   1. A `post_delete` event is handled, other objects may be altered or deleted because of this.   2. At the end, notifications should be sent to users. Here, it would be nice if arguments passed to the notification handler were copies of deleted or to-be-deleted objects and guaranteed not to change in the handler. (It could be done manually simply by not passing objects managed by the ORM to handlers, of course.)


Do we actually have to pay to make Windows Phone, Android, or iPhone apps?

I want to know how much does it cost to develop a free phone app (which means i price it at $0) on:   1. WP7   2. iPhone   3. Android What if now I want to price the app at $0.99? How much do I have to pay if its:   1. WP7   2. iPhone   3. Android Also, do I need additional hardware (I'm using Windows Vista Home Premium 32-bit) And do I need to pay for any software?


What's a generic word for both Methods and Attributes?

In a class diagram, each class contains methods and attributes. What's the correct word for describing both of them besides something generic such as contents or items? Context: > The Orange class extends the Fruit class and inherits its **stuff**. where _stuff_ = a single word for both methods and attributes


Will taking a job that's web and database related limit my software development opportunities later on?

I love programming, particularly OOP. My school experience was mostly in Java/OOP, and I had a job for a limited time in Java, Python, and other OOP kind of languages. However, a move necessitated a change in jobs, and what I've ended up with now is a web-development and database intensive job. I may possibly hold this job for several years. My question is, will this limit my choices later on? Will I be able to find another Java / software-development kind of job, or will I be rejected because my experience will be mostly in a different area?


How does git use SHA-1 to detect corruption in transfers?

I've been reading about git in Apress' "Pro Git" book. It mentions that SHA-1 is used to detect changes to commits and also to verify there is no corruption during pulls from the server. I am aware of the message digest detecting change, but how is it checking and presumably correcting for corruption ? The Wikipedia page for SHA-1 does not mention features like CRC. Thanks, Scott


3 Tier Application Architecture, logic and database

(Note: The examples are simplified) I've seperated my solution into 3 projects   * WebSite   * Business Logic   * Data Access Logic The Website has access to BL and DAL   The BL has access to nothing   The DAL has access to the BL On the website I can do something like               BL.User user = DAL.GetUser(1)      I also have this type of logic in the website               user = [new user information]          If Not DAL.DoesEmailExists(user) Then         DAL.InsertNewUser(user)     End If      What would be my option to remove this if/insert from the website?   My ideal option would be to put this logic inside the BL.User but that's not possible. If the BL has access to the DAL it will make a circular reference.


What should I look for when job-hunting to find a strong OOD focus?

I'm currently seeking a job. I've got a good CV, but little industry experience, and so my difficulty is that I'm not entirely certain what I'm looking for. **What I've done** is a good BSc in Computer Science, and an extensive six- year stint as an all-purpose programmer in a military unit. I won't go into the details, but I've worked on a fairly large number of projects, with huge variety but each of fairly limited scope. I'm also, so far, very much a generalist - I don't have a specific domain I specialize in. **What I've enjoyed most** has been in the realm of design - the object-oriented design of modules, APIs, project architecture, what-have-ye. **As an eventual goal** I believe I'd like to see myself as a software architect. **What I'd like right now** is a position where the OOD features significantly - where I can learn and develop my skills, and eventually practice OOD at a rather larger scale than I have so far. Obviously, nobody has pure OOD as a job description; that's not what I'm expecting and it's not what I'm looking for. But I'm somewhat unfamiliar with the major sub-fields of the software engineering job market, and I my knowledge of major current technologies is pretty basic. I'm finding it very hard to tell from a job description (and even from speaking to an interviewer) whether the job is likely to have a major design element. So many positions I see could involve lots of OOD, or none at all - or at least, so it seems to this inexperienced job-seeker. It seems to depend so much on the precise nature of the job, and on how precisely they use tech stacks I don't know (and won't even know the names of without serious digging, or accepting the job :P). **What can I look for in a position to find a job with a focus on OOD?** Are there particular fields, company-types, or positions I should seek or avoid? Are there questions I can ask at interviews that will help me out?


I have a library and several small programs that use it: how should I structure my git repositories?

I have some code that uses a library that I and others frequently modify (usually only by _adding_ functions and methods). We each keep a local fork of the library for our own use. I also have a lot of small "driver" programs (~100 lines) that use the library and are used exclusively by me. Currently, I have both the driver programs and the library in the same repository, because I frequently make changes to both that are logically connected (adding a function to the library and then calling it). I'd like to merge my fork of the library with my co-workers' forks, but I don't want the driver programs to be part of the merged library. What's the best way to organize the git repositories for a large, shared library that needs to be merged frequently and a number of small programs that have changes that are connected to changes in the library?


Should an open source gem contain .rvmrc?

Using `.rvmrc` seems to be considered a best practice for apps. But should an open source gem contain `.rvmrc` in their source code on Github? I think it's not good to require everyone who wants to contribute to use the exact same version of Ruby or gemset as you.


linux script as a service within PHP & JS

Is it possible to create a web application/service in PHP in which the backbone of the application/service is really a linux script and PHP is just relaying the data from the script? The linux script requires certain types of hardware and drivers in order to execute smoothly. I will be hosting the web application and linux script however not the hardware or drivers. I'm thinking of writing up some javascript code that will check if the end-user meet the hardware/driver requirements & have some sort of connection, if so the linux script will execute and utilize the user's hardware to process data that is then passed to PHP. YIKES!? ;o Is my approach for this correct or is there an easier way? Thanks!


Schemes to resolve deadlocks

I am interested in research that detects and recover from deadlocks. In other words the system is able to recover from deadlock faults. I'm interested in shared memory multicore processors. Uptill now I have only seen research for distributed systems. Can anyone guide me on this.