title: Are there any ultra high level languages out there?

text: Historically a HLL is something like C, Fortran or Pascal and a VHLL is something like Ruby or Python. I am familiar with the terms 4GL, 5GL, DSL and LOP, and those who aren't should read Wikipedia for the definitions. I'm looking for UHLLs. My question is: are there any computer languages out there which are another order of magnitude more productive, and is anyone working on them? More productive means less authored code and less programmer time to achieve a result, less bugs and less debugging, closer conceptual link between code and requirements, less effort to modify and maintain. The main domain that interests me is general-purpose business and consumer applications, with a GUI or browser front end, data persistence and connections to other systems such as printing and email. Other people might well focus elsewhere. I recognise that some of those languages might be domain-specific, and that they might be little more than the configuration capability of a large and capable application. Excel spreadsheets fall into this category. I recognise that some of those languages might appear general, but might still be narrow in scope and unsuited to many problems. For example, Matlab might not be a good choice for a program that deals mainly with user interaction and textual data. I know some of the features that might be in a UHLL, by analogy with VHLL. I would expect to find one or more of the following (and feel free to add to the list):   * A drawing of a GUI form IS the program for a GUI form   * A table containing rows, columns and headers IS the program for a table in a database   * Declarative logic says what should be done and when, with no IF statements   * Operations on sets of data, with no FOR loops   * Non-sequential execution eg data driven, pattern matching, tree walking The motivation for the question is that I am increasingly fed up with the sheer hard work of translating relatively simple business requirements into large quantities of code to cater for what the computer wants or needs. The question is really about finding others out there who share my pain and are working on raising the level of languages and getting the computer to do more of the hard work. This was a major focus in the 1970s-80s, but is it still happening? These are some suggested answers to my question, provided here to to summarise or enumerate languages I know about, and which in my view fall short. There are many languages that are HLL or VHLL and contain individual features that belong to a higher level. I've used most of them (often badly). They include   * Lisp, with its macros and ability to self-modify   * Haskell, with data dependency and pattern matching   * SQL, which deals in rows and tables   * Rebol, which seems clever but I don't really get it   * APL (and J), with its multi-dimensional arrays and ultra-compact operators   * C# with LINQ   * AWK/Perl/Python/Ruby with wonderful collections and regexes built in These languages have too many low level features to be UHLL. The programmer still has to write many low level constructs for any useful program. There are RAD/4GL packages. I've used some:   * dBase/Foxpro   * Dataflex/Powerflex (my product)   * Access   * PowerBuilder And lots more I haven't used. Mostly the language is HLL at best but the package contains a framework and privileged connections between language and package so that applications can be built fast. I'm not sure why this approach ran out of steam, but in any case UHLL this is not. There are raw frameworks/libraries. I've used a few:   * Rails   * Java awt and swing   * .NET Windows Forms, WPF and ASP.NET. These are currently the state of the art. They leave the programmer firmly trapped in the mire of the implementation language, dealing with complexity at every turn. This is not UHLL, but a UHLL might conceivably be built on top of one of these. There are design tools, like UML and Rational's toolset, which I don't know well. As far as I can see they help articulate business requirements but can never replace the programming step. I don't want to eliminate programmers, just get more done per unit of time and effort. So having eliminated all contenders I can think, I hope someone else can provide a better candidate. Late Edit: I think I have an answer: Wolfram Language. http://www.wolfram.com/wolfram-language/


title: Why is it a good idea for "lower" application layers not to be aware of "higher" ones?

text: In a typical (well-designed) MVC web app, the database is not aware of the model code, the model code is not aware of the controller code, and the controller code is not aware of the view code. (I imagine you could even start as far down as the hardware, or perhaps even further, and the pattern might be the same.) Going the other direction, you can go just one layer down. The view can be aware of the controller but not the model; the controller can be aware of the model but not the database; the model can be aware of the database but not the OS. (Anything deeper is probably irrelevant.) I can intuitively grasp why this is a good idea but I can't articulate it. **Why is this unidirectional style of layering a good idea?**


title: What layers reference each other in a multi layer design?

text: I'm creating a project and I'm having difficulty and contrasting opinions on how to do things when it comes down to separating layers. I'm not fully sure what layers should reference each other. I have read in certain blogs/posts that the flow should be   * the view references the business layer   * the business layer references the data layer   * the data layer only knows about it self On the other hand I have also seen the following   * the view references the business layer   * the business layer knows only about itself   * the data layer references the business layer Using the second method I have been using the business layer using IOC but im reluctant to progress without more knowledge. I have read a number of posts but the answers seem many and varied. Any clarification would be great. Thanks


title: Is it bad practice to call a controller action from a view that was rendered by another controller?

text: Let's say I have an `OrderController` which handles orders. The user adds products to it through the view, and then the final price gets calculated through an AJAX call to a controller action. The price calculation logic is implemented in a seperate class and used in a controller action. What happens is that I have many views from different controllers that need to use that particular action. I'd like to have some kind of a `PriceController` that I could call an action on. But then the view would have to know about that PriceController and call an action on it. Is it bad practice for a view to call an action on a different controller from which it was rendered?


title: How to integrate and Program Avatar customization in HTML(5)?

text: I am making a Game in HTML5. In one part of it, I want the users to be able to customize the avatar they get by default. For sample, let me share a screenshot from Zombie Lane on Facebook (now this game may not be in HTML5 but that's not the point): ![enter image description here](http://i.stack.imgur.com/RXseK.png) My question is as to how do I include the images in the HTML5 page and in which format? Whenever a clothing is different shirt is selected, the change is applied immediately. Is it a whole new photo that we see, or is the photo changed somehow by programming? How is it done?


title: What does "automating a use case" mean and  what are the tools to do it?

text: What does 'automating a use case 'means and how does the tools that automate helps with that? whats makes automation good to do and does it holds any significance for web developement.


title: Syncing client and server CRUD operations using json and php

text: I'm working on some code to sync the state of models between client (being a javascript application) and server. Often I end up writing redundant code to track the client and server objects so I can map the client supplied data to the server models. Below is some code I am thinking about implementing to help. What I don't like about the below code is that this method won't handle nested relationships very well, I would have to create multiple object trackers. One work around is for each server model after creating or loading, simply do `$model->clientId = $clientId;` IMO this is a nasty hack and I want to avoid it. Adding a setClientId method to all my model objects would be another way to make it less hacky, but this seems like overkill to me. Really clientIds are only good for inserting/updating data in some scenarios. I could go with a decorator pattern, but auto generating a proxy class seems a bit involved. I could use a generic proxy class that uses a __call function to allow for original object data to be accessed, but this seems wrong too. Any thoughts or comments?               $clientData = '[{name: "Bob", action: "update", id: 1, clientId: 200}, {name:"Susan", action:"create", clientId: 131} ]';     $jsonObjs = json_decode($clientData);               $objectTracker = new ObjectTracker();     $objectTracker->trackClientObjs($jsonObjs);               $query = $this->em->createQuery("SELECT x FROM Application_Model_User x WHERE x.id IN (:ids)");     $query->setParameters("ids",$objectTracker->getClientSpecifiedServerIds());     $models = $query->getResults();          //Apply client data to server model     foreach ($models as $model) {         $clientModel = $objectTracker->getClientJsonObj($model->getId());                   ...      }               //Create new models and persist     foreach($objectTracker->getNewClientObjs() as $newClientObj) {         $model = new Application_Model_User();         ....         $em->persist($model);         $objectTracker->trackNewServerObj($newClientObj['clientId'],$model);     }     $em->flush();          $resourceResponse = $objectTracker->createResourceResponse();          //Id mappings will be an associtave array representing server id resources with client side     // id.     //This method Dosen't seem to flexible if we want to return additional data with each resource...     //Would have to modify the returned data structure, seems like tight coupling...     //Ex return value:     //[{clientId: 200, id:1} , {clientId: 131, id: 33}];


title: what would be the best data structure for my situation

text: I have a list of **unique string**. I don't want to destroy this string i need it.I only need to find out weather an given string S exist in this unique list.What would be the best data structure for this purpose.


title: Relationship DAO, Servlet, JSP and POJO

text: I want to implement a `JSP`, `POJO`, `DAO` and `Servlet` in my `J2EE` program. However, I don't fully understand how the relationship between these elements should be. Is the following (MVC) setup the right way to do it?   * Main class creates servlet(controller)   * Servlet has a `DAO` defined in its class   * `DAO` has a `POJO` defined in its class   * `Servlet` communicates with the view (JSP page) Please give your feedback.


title: How can you get constructive criticism for your code?

text: My team rarely does code review, mainly because we don't have enough time and people lack the energy and will to do so. But I would really like to know what people think about my code when they read it. This way, I have a better understanding how other people think and tailor my code accordingly so it's easier to read. So my question is, how can I get constructive criticism for my code? My intent is to understand how people think so I can write more readable code.


title: Capture portions of a number using mathematical operations

text: Is there a mathematical way to get the following: For the the number 777,888,999 so 777 million and etc etc getMillions(777888999) should return 777 only getThousands(777888999) should return 888 only getHundreds(777888999) should return 999 only This should be done **without using regex and without text processing** but should be achieved using **only mathematical operations**. I'm trying to solve a problem that may be familiar to some which is converting a number expressed in digits to words so 1 -> one, 10 -> ten, 100 -> one hundred etc My thinking is that if I can convert a number up to 999 then the problem is pretty much solved as the rest will only append the words millions and/or thousands so 777888999 will covert to the words: 777 million and 888 thousands and 999 hundred of course the above numbers will expressed in words. This originally was given to me as part of a job interview process about a year ago. I am absolutely not using the solution here for a job application. But the above question is about number manipulation which I'm very interested in.


title: What do you call a tree that grows in both directions?

text: ![tree representation](http://i.stack.imgur.com/mHAbK.jpg)What would be the technical term for a tree that grows in both the directions, starting from the root in the middle? The central idea being that new elements can be added to the tree (Now, I am not sure if it is even okay to call it one) in both the directions. But, when used for traversal purposes, you need to follow the directed links.


title: Negative test cases confusion

text: In the Software testing book from Koirala, Sheihk, they say: > A positive test is when you put in a valid input and expect some action to > be completed in accordance with the specification.   >  A negative test is when you put in an invalid input and receive errors. Part of my question: Let's say there is a requirement: If the customer name=="James Bond", do something. Is `name<>"James Bond"` negative or still positive test, verifying the requirement? Or a login function:   Is correct login positive test case and incorrect negative?   Or Login failed is just confirmation of requirement that a password must be correct ->confirming invalid pass will not work. > For example, if the program is supposed to give an error when the person > types in "101" on a field that should be between 1 and 100, then that is > positive then if an error shows up. If, however, the application does not > give an error when user types 101, then you have a negative test.


title: Why should form inheritance be avoided?

text: I remember learning VB4 and dragging a button onto a form, double-clicking on that button, and typing code into that event handler I had just been magically blessed with. Coming from QBASIC I was thrilled with the "V" in "VB", the visual designer was literally the best thing since sliced bread. Of course you could do all that programmatically but the magic of the "V" was so appealing you just couldn't help but drag that button. We were encouraged to take that route. But then a few years ago I started learning about C# and the .net framework and was fascinated by the way everything I thought I knew had just gone out the window. There's a lot of _magic_ going on in VB6 that's completely unveiled in .net: take constructors and the `InitializeComponents` method for example. In the latter you'd find all the control instances you've dragged from the toolbox, all the events you've registered and the properties you've set in the designer. And that's fine... I guess. It's just, I feel like I don't "own" what's going on, this code that I can only modify via the designer annoys the heck out of me. Every time you copy a button that says "Ok" from one form to another (sometimes along with its brother "Cancel"), you are actually duplicating code, and that's a _sin_ isn't it? DRY, don't repeat yourself, says the _Pope_. Religions and schools of thought aside, in all objectivity, shouldn't we derive forms from base forms instead, and have the "Ok" button (and all of its friends) live on the base form? Something like a `FormBase` from which derives a `DialogFormBase`; all classes created in no time... by typing code. The buttons are created depending on how the class is instanciated (i.e. a constructor enum argument determines which buttons are to be created), controls are laid out inside an arrangement of split panels and flow layout panels, injected into the form as `Content` that fits into the main content panel. Isn't this what ASP.net does with master pages and content placeholders? I'd derive a form when I need a new "master page", but this new "master page" still derives from a base form class so the visuals are consistent across the entire application. To me that's _much_ more code reuse than anything else I've ever done with the designer in WinForms, and it wasn't even hard, and code isn't cluttered with a 200-lines method that I have no control over, I can put comments where I like, they won't get overwritten by a designer. I guess it's just a matter of patterns and architecture, which is what brought me to this link: Best design for Windows forms that will share common functionality, where I realized I was spot on, except **the answer there, suggests exactly what I'm doing, but it's advising _against_ form inheritance _because_ of designer considerations. That's the part I don't get**. I would rather advise _against_ using the designer _because_ of code structure considerations, especially in regards with form and control inheritance, which I see no reason to avoid other than _well it breaks the designer_. We can't all be just lazy, so what part am I missing?


title: "Never do in code what you can get the SQL server to do well for you" - Is this a recipe for a bad design?

text: It's an idea I've heard repeated in a handful of places. Some more or less acknowledging that once trying to solve a problem purely in SQL exceeds a certain level of complexity you should indeed be handling it in code. The logic behind the idea is that for the large majority of cases, the database engine will do a better job at finding the most efficient way of completing your task than you could in code. Especially when it comes to things like making the results conditional on operations performed on the data. Arguably with modern engines effectively JIT'ing + caching the compiled version of your query it'd make sense on the surface. The question is whether or not leveraging your database engine in this way is inherently bad design practice (and why). The lines become blurred further when all the logic exists inside the database and you're just hitting it via an ORM.


title: How to research a company to work at

text: I have been made an offer at a company. How do I research it to find if its somewhere I would like to work, besides asking them questions? Google search gives little results.


title: When people work in different countries and need to work together how to keep code in correct language

text: I'm a member of a small new team and with one of our latest builds I noted that, VS2010 code files don't contain language formatting. So for example when I write down a Euro symbol in my code or use a "." or "," in numbers or use Pounds, Euro or Dollar symbols, those look ok in my code, but for a coder in Russia they don't. I wonder how other people tackle these kind of problems?


title: How to encapsulate 'global' variables in C#? /best practice

text: In C# what is the best practice for encapsulating variables I need to use in multiple methods? Is it OK to simply declare them at the top of my class above the two methods? Also if I am using app settings from my config file should I use a getter? like this...               private string mySetting{ get { return WebConfigurationManager.AppSettings["mySetting"]; } }      What best practice is?


title: Documentation: What is "appropriate" when expressing a valid range for a parameter?

text: What is the appropriate method to describe a valid range of a parameter in the documentation of code? Obviously long-form documentation (white papers, API documents, etc) can be more verbose than the actual code but this is really to address issues in the actual code than in the distributed documentation (that every user should read to begin with!) Examples:   * <argument name> where { <argument name> | 0 <= <argument name> <= 255 }   * <argument name> range: [0,255]   * <argument name> is valid between zero and 255 inclusive.


title: What does a good "definition of done" for a mature team look like?

text: When looking at examples of definitions of done in various sources, they usually include points like   * code completed   * unit tests run   * code peer-reviewed or paired   * code checked in   * documentation updated   * … In our team, we have a similar list, but nobody ever looks at it because those points seem so blatantly obvious that it wouldn't occur to anyone to skip any of these steps. So we were wondering whether that's mainly a tool for teams transitioning to an agile process and whether we shouldn't just get rid of it. On the other hand, lots of literature claims that all high-performing teams have a strong definition of done. This kind of hints that we might miss an opportunity to improve here. So what are examples of strong definitions of done of a mature team? What kind of points do they include typically?


title: What are the usual difficulties in concurrent programming and tuning of concurrent programs (shared-memory model)?

text: I can list part of the problems that will show up when writing a moderately- sized concurrent application with shared memory:   * Locking granularity   * Choice of synchronization primitive   * Number of threads   * Method for decomposing into threads (data parallelism; task parallelism; how threads are organized, etc) What are other similar problems?


title: Using a parser to locate faulty code

text:
Lately I've been working a lot in PHP and have run into an abnormally large number of parsing errors. I realize these are my own fault and a result of sloppy initial coding on my part, but it's getting to the point that I'm spending more time resolving tags than developing. In the interest of not slamming my productivity, are there any tricks to locating the problem in the code? What I'd really be looking for would be a line to put in the code which would output the entire faulty tag in the parsing error, or something similar. Purely for reference sake, my current error is Parse error: syntax error, unexpected '}' in /home/content/80/9480880/html/cache/tpl_prosilver_viewtopic_body.html.php on line 50 (which refers to this):

<?php if ($_poll_option_val['POLL_OPTION_RESULT'] == 0) {  echo ((isset($this->_rootref['L_NO_VOTES'])) ? $this->_rootref['L_NO_VOTES'] : ((isset($user->lang['NO_VOTES'])) ? $user->lang['NO_VOTES'] : '{ NO_VOTES }')); } else { echo $_poll_option_val['POLL_OPTION_PERCENT']; } ?>

 <?php }} if ($this->_rootref['S_DISPLAY_RESULTS']) {  ?>

<?php echo ((isset($this->_rootref['L_TOTAL_VOTES'])) ? $this->_rootref['L_TOTAL_VOTES'] : ((isset($user->lang['TOTAL_VOTES'])) ? $user->lang['TOTAL_VOTES'] : '{ TOTAL_VOTES }')); ?> : <?php echo (isset($this->_rootref['TOTAL_VOTES'])) ? $this->_rootref['TOTAL_VOTES'] : ''; ?>

 <?php } if ($this->_rootref['S_CAN_VOTE']) {  ?>

<input type="submit" name="update" value="<?php echo ((isset($this->_rootref['L_SUBMIT_VOTE'])) ? $this->_rootref['L_SUBMIT_VOTE'] : ((isset($user->lang['SUBMIT_VOTE'])) ? $user->lang['SUBMIT_VOTE'] : '{ SUBMIT_VOTE }')); ?>" class="button1" />

 <?php } if (! $this->_rootref['S_DISPLAY_RESULTS']) {  ?>

<a href="<?php echo (isset($this->_rootref['U_VIEW_RESULTS'])) ? $this->_rootref['U_VIEW_RESULTS'] : ''; ?>"><?php echo ((isset($this->_rootref['L_VIEW_RESULTS'])) ? $this->_rootref['L_VIEW_RESULTS'] : ((isset($user->lang['VIEW_RESULTS'])) ? $user->lang['VIEW_RESULTS'] : '{ VIEW_RESULTS }')); ?>

 <?php } ?> </fieldset>


title: In rails, what defines unit testing as opposed to other kinds of testing

text: Initially I thought this was simple: unit testing for models with other testing such as integration for controller and browser testing for views. But more recently I've seen a lot of references to unit testing that doesn't seem to exactly follow this format. Is it possible to have a unit test of a controller? Does that mean that just one method is called? What's the distinction? What does unit testing _really_ means in my rails world?


title: Should I use one database per application or share a single database amongst multiple applications

text: I have multiple applications some that use data from the same sources. Is it best practice (or what are the pros/cons) to:   * leave the data in databases shared by multiple applications     1. saves space as only one database is needed     2. complicates indexing as different applications have different querying needs   * import data daily into per-app databases     1. uses more space as duplicated data exists in per-app databases     2. easier indexing as each app can focus on its individual needs I may have left out other advantages/disadvantages, please list if any, also how is this done at your workplace?


title: What is the meaning of driven ? (test-driven , data-driven, event-driven and etc)

text: I was reading a paper that makes a comparison between ASP.NET Web Forms and ASP.NET MVC. While reading it, such as data-driven, event-driven, test-driven are the terms that I see a lot. So what are they used for? when we can call them for a programming language or framework? What do they need to have?


title: Why are effect-less functions executed?

text: All the languages I know of would execute something like:               i = 0     while i < 100000000         i += 1      ..and you can see it take a noticeable amount of time to execute. Why though, do languages do this? The only effect this code will have is taking time. edit: I mean inside a function which is called               function main(){         useless()     }     function useless(){         i = 0         while i < 100000000             i += 1     }


title: Is it bad practice for a module to contain more information than it needs?

text: I just wanted to ask for your opinion on a situation that occurs sometimes and which I don't know what would be the most elegant way to solve it. Here it goes: We have module A which reads an entry from a database and sends a request to module B containing ONLY the information from the entry module B would need to accomplish it's job (to keep modularity I just give it the information it needs -> module B has nothing to do with the rest of the information from the read DB entry). Now after finishing it's job, module B has to reply to a module C if it succeeded or failed. To do this module B replies with the information it has gotten from module A and some variable meaning success or fail. Now here comes the problem: module C needs to find that entry again BUT the information it has gotten from module B is not enough to uniquely find the exact same entry again. I don't think that module A giving more information to module B which it doesn't need to do it's job but which it could then give back to module C would be a good practice because this would mean giving some module information it doesn't really need. What do you think?


title: Software updating solution for both Linux/Windows platform

text: Are you guys aware of any commercial (non-commercial?) online automatic updater that can be integrated with one's software? After quick research I found zillions of them but for Windows only and again only few got C/C++ API. Do this kind of solutions have any update management/statistics features?


title: Do you care if the person you're interviewing owns or contributes to Open Source projects?

text: Do you care if the person you're interviewing has created or contributed to Open Source projects? From the pool of people we've interview over the years at my workplace, I haven't found one person who contributes to an open-source project. In fact I'm the only person in the office that is really interested in the (.NET) OSS scene, but I don't believe that makes me any more competent, and it possibly reflects on my social life more than anything. Does OSS participation make your ears prick up if you see it on a CV/Resume? Or are you apathetic towards it? _(This is what made me think of the question)_


title: How do I learn Concurrency in Ruby?

text: Yesterday I read this great article about Concurrency in JRuby from EngineYard and I realise I need to leverage my skills about concurrency in Ruby, by mentioning Ruby here I mean it could be **all** implementations of Ruby : JRuby, Ruby MRI, Rubinius, Ruby on Parrot / Cardinal except IronRuby, I don't code in Windows Environment. What I learned from Haskell world, especially from Simon Peyton-Jones, he said on his video that OOP is all about state. Note: I'm very very inexperienced when I mention Haskell, I only watched some good videos about Haskell, solved very few (less than 10) euler project in Haskell, read some good Haskell books and tutorials, I've never coded in Haskell professionally, I just read some source codes in Haskell, ex. pugs, Darcs, and some other Haskell codes I don't remember the source. I might want to use Jaskell to trick concurrency as long as I use jruby, but that's for my long term learning plan, I want to maximise my concurrency skill in ruby first, **do you have any suggestions for me to learn concurrency in ruby?** I wish there were a kind of Head First book for me to learn Concurrency in Ruby. Things like strategies / how to tackle concurrency problem in ruby, inspired from EngineYard article and Haskell. Maybe some good downloadable videos that explain step by step to strengthen my fundamental about concurrency generally and then move to concurrency in ruby specifically. Advice? Thank you.


title: What's the difference between robustness and fault-tolerance?

text: Systems / programs / distributed algorithms / ... are often described with the predicate **robust** or **fault-tolerant**. What is the difference? * * * Details: When I google for +robust +"fault-tolerant", I only get two hits, both unhelpful. When I googlescholar for the terms, I find a lot of papers that have both terms in their title. Unfortunately, they do not precisely define the terms :( But since they use both terms, it seems that neither implies the other.


title: I'm having trouble learning

text: I'm only 13 but i'm genuinely interested in CS and would really like it if I could actually accomplish it. I've read books on C++ and C#, but ALL of them are the same!! They all say "Ok so since you have no prior knowledge in this what so ever, write a snippet that will do this and then make a GUI and then throw it into the Priafdhsu hfad then add the program and then program your own compiler to do some stuff". It's really getting annoying. I've payed near $40 (via Paypal) on ebooks that supposedly taught people to program with no prior knowledge. ALL OF THEM EXPECT ME TO ALREADY KNOW THE LANGUAGE. Is there something that I'm missing or am I suppose to be born with the property of CS? I would very much appreciate it if someone could explain this to me or possibly refer me to a tutorial on Programming Theory that starts from below ground zero as I have know knowledge in CS at all.


title: Delphi 7 using RAM for database

text: I have an existing database app written in D7 with apollo databases. The client has given me a fast desktop with 24gb ram Can I somehow load the database files into ram to speed up processing? With millions of records some procedures take 1/2 hour or more, mostly due to disk read/write


title: Record management system java web framework

text: We're currently reconsidering technologies and frameworks to get more agile with "simple" RMS CRUD-based projects. In short, short-living things like this Right now we have a custom extension on top of SmartGWT but after some time it has proven not to be flexible enough. I also personally dislike the java-js compilation process and the whole GWT codebase. Not only is the design ugly, it also makes certain low-level js things very complicated if not completely impossible. So what I'm looking for is:   * closest to **web** as possible, like JSF or possibly Tapestry, it is very important to be able get "low" and weave framework if necessary. Happens more often than we thought.   * datagrid capable - Ext.js & PrimeFaces looks pretty good, Vaadin does too.   * db-schema generators (optional, no matter in which way) If it were only on me, I'd probably stick to Ext.js + custom rest-based java solution, possibly generated from database schema (not sure about concrete tooling yet). I only have experience with vanilla Ext.js, vanilla GWT and JSF 2.0 / Seam, so it hard for me to judge or even propose other frameworks. **Whats your experience?** **What are the downsides you've faced?**


title: How to unit test a web client?

text: I am having a lot of trouble understanding how to unit test my web client. I have just finished a project using TDD for the first time - this project hd no external dependencies such as API calls or databases, it was pure C# code. I definitely saw the benefits of using TDD and I would like to continue practising it. My next project involves writing a SOAP client. I'm struggling to get past the first test which is using a simple IClient that logs in to the API successfully. Here is the IClient interface:               public interface IClient     {         bool IsLoggedIn { get; }         bool Login(out string error);     }      I have no idea how I would go about testing this. I'm thinking the unit test method would be something like `Login_WithValidCredentials_ReturnsTrue`, but I'm not sure how I could do this without actually simulating every possible response from the API. Is this code actually unit testable, or should this be left to an integration test. If anyone could give me an example of a simple unit test then I would be very grateful (I am using Moq).


title: Are there examples of non CRUD approaches?

text: I'm a programmer but also have worked as an archivist. As archivist it's a lot about keeping data. I often get into arguments with colleagues when it comes to operations on data. I don't like the U and the D in CRUD too much. Rather then update a record I prefer to add a new one and have a reference to the old record. That way you build a history of changes. I also don't like deleting records but rather mark them as inactive. Is there a term for this? Basically only creating and reading data? Are there examples of this approach?


title: New to Data Warehouses/ERP

text: The organisation I work for is very application rich i.e. there are lots of SQL and Oracle databases. We are thinking about a data warehouse. I believe there is a difference between an Enterprise Resource Planning system and a Data Warehouse. An ERP would involve integrating all the systems together and having one database schema for everything. A Data Warehouse would involve creating a copy database (or copy databases) for analysis reasons. The Data Warehouse could extract information from the original repositories or the ERP system. Have I understood this correctly? Are there Data Warehouse products that are available to but or to you have to use Microsoft tools/Oracle tools e.g. SSIS, SSAS etc to write your own?


title: Website as an API client vs using the API only when needed?

text: I'm developing a website (using **Django** ) which will depend on an API for it's main functionality which is create/update/delete objects. But the API also provides:   * User sign up and login   * User relations to their objects   * User groups and permissions This is great but I'm conserned about fully depending on the API for everything even user sign up and login, so I have 2 choices: **Using the API for everything** : Advantages:   * User authentication, objects, relations, permissions are already managed   * My job is only to query the API and display the results Disadvantages:   * Lots of HTTP requests to the API   * The website will break if the API goes down   * The website rendering time will be slower (will use ajax) **Using the API when needed** : Advantages:   * Fewer HTTP requests   * The website will be a little faster   * If the API goes down, not all the functions of the website will stop Disadvantages:   * I'll have to manage user authentication, permissions and relations to his objects in the API   * Duplicate user data in my database and the API (I'll have a copy of the user objects)   * Worried about the data sync (I'll update the database only on create/update/delete requests to the API) Which one is a better choice and why ? what design is usually used for such cases ?


title: What non-programming tools do programmers use?

text: I'm reading _Code Complete_ with the intention of learning how to better structure my code, but I'm also learning a lot about how many aspects of programming something there are that aren't just writing the code. The book talks a lot about problem definition, determining the requirements, defining the structure, designing the code, etc. What tools are used for these non-writing steps of programming? Is there software that will help me design and plan out what I'm going to write before I do?


title: Can I use a part of another program without having to give away my rights on my own code?

text: I'm currently making a game and want to use some textfiles (lists of names) that are covered under the GNU General Public License (or the Attribution- ShareAlike 3.0 Unported License). Do I have to release my whole game under one of these licenses if I only used these (relatively small) files in my game or is it just these files I have to keep licensed like that? If this is not permitted am I allowed to do this anyway if I choose not to actually release my code and only "hosted" this game, since it's a web game.


title: Partitioning set into subsets with respect to equality of sum among subsets

text: Let's say I have `{3, 1, 1, 2, 2, 1, 5, 2, 7}` set of numbers, I need to split the numbers such that sum of subset1 should be equal to sum of subset2 `{3,2,7} {1,1,2,1,5,2}`. First we should identify whether we can split number(one way might be dividable by 2 without any remainder) and if we can, we should write our algorithm two create s1 and s2 out of s. How to proceed with this approach? I read partition problem in wiki and even in some articles but I am not able to get anything. Can someone help me to find the right algorithm and its explanation in simple English?


title: Future scope for a mobile Developer

text: I’ve started my career as a Software Tester but after 3 years I realized, it didn’t give me the so called job satisfaction and I made a brave decision to jump into software development arena. Finally I have become an Android Mobile developer and completed 1 year of experience. I love my job and I love every bit of it, but going forward I’m wondering what the scope for mobile developers is?? Developers who work with C# or Java have their larger scope and they can become architect etc in future. But as a mobile developer what can I achieve.. Mobile development architect is not something practical because mobile projects are small and it does not require much technical ability like j2ee project needs. Should I change my career track to Java or j2ee or something from mobile?? Any advice is appreciated.


title: How should templates be named?

text: In D I can create templates like this:               template Foo(A) {         A add(A a, A b) { ... }         A multiply(A a, A b) { ... }         A concatenate(A a, A b) { ... }     }      What should a template be named ideally? What conventions exist out there? I'm looking to something similar like 'function names must always start with a verb'.


title: Which is best for learning how to do a certain thing: writing your own or looking at someone else's?

text: Often when I'm writing code to do a certain thing, I'm faced with either writing my own or using someone else's code. Assume here that this "thing" is something that I've never done before and am interested in learning how it's done. **Which would you say is better from a learning perspective: try writing your own solution; or looking at code by someone else?** I've always written my own code if I have an idea on how to do it, but resorted to looking at someone else's when I don't have a clue. I believe that the best is probably a combination of both: make your own attempt and then look at how someone else did.


title: Examples of Java APIs that demand an action sequence

text: As part of a research I'm working on, I'm looking for public APIs that only work correctly when you apply a certain sequence of actions on them. For example, the `java.nio.channels.SocketChannel` class, from the Java standard library, only works correctly with sequences such as `open() -> connect() -> read() -> read() -> close()`. A more complete demonstration if how it may be used may be represented in the following graph: ![valid usage of SocketChannel](http://i.stack.imgur.com/zVOq9.png) Additional examples of Java standard library APIs that require certain sequences are `java.io.PrintStream` (very similar to the one above) and `java.util.Iterator` (which requires a `next()` call between every two `remove()` calls, thus enforcing a certain sequence). So, does you favorite API for doing X also behave that way? **I would very much like to know about additional APIs that require a certain method sequence for correct usage** ; especially classes that are not part of the Java standard library. The more complex the sequence(s) required, the better. * * * Some APIs require a sequence that spans across multiple classes, for example:               X x = new X();     x.setup();     Y y = x.createNewY();     Z z = new Z(y);     z.doSomething();      These examples are also interesting, but I'm mostly looking for sequences that all appear in the same class. * * * **EDIT** added bounty for greater visibility. I'm sure many of you have encountered many APIs that will match this description - I would really appreciate some good examples.


title: Types of quotes for an HTML templating language

text: I'm developing a templating language, and now I'm trying to decide on what I should do with quotes. I'm thinking about having 3 different types of quotes which are all handled differently:                                    backtick `     double quote "     single quote '     expand variables         ?              yes                 no     escape sequences        no              yes                  ?     escape html             no              yes                 yes      ## Backticks Backticks are meant to be used for outputting JavaScript or unescaped HTML. It's often handy to be able to pass variables into JS, but it could also cause issues with things being treated as variables that shouldn't. My variables are PHP-style (`$var`) so I'm thinking that might mess with jQuery pretty bad... but if I disable variable expansion w/ backticks then, I'm not sure how would insert a variable into a JS code block? # Single Quotes Not sure if escape sequences like `\n` should be treated as literals or converted. I find it pretty rare that I want to disable escape sequences, but if you do, you could use backticks. So I'm leaning towards "yes" for this one, but that would be contrary to how PHP does it. # Double Quotes Pretty certain I want everything enabled for this one. ## Modifiers I'm also thinking about adding modifiers like `@` or `r` in front of the string that would change some of these options to enable a few more combinations. I would need 9 different quotes or 3 quotes and 2 modifiers to get every combination wouldn't I? My language also supports "filters" which can be applied against any "term" (number, variable, string) so you could always write something like               "blah blah $var blah"|expandvars      Or               "my string"|escapehtml      Thoughts? What would you prefer? What would be least confusing/most intuitive?


title: Why use getters only as opposed to marking things final?

text: I'm working in a java role after working a couple years in functional programming. Our company was bought by google and I took a java role after the acquisition. Coming back to java as a polyglot developer, I'm generating getters for immutable objects and I'm seeing it's a total hogwash. Are there any reasons why the 'getField' convention should be used so prolifically? To me it seems almost horrifying at this point that so many libraries expect public getter methods to work with their functionality when simply making a field public and final would have the same effect as making only a getter on a public mutable field. Why isn't it more of a common practice to ditch the setters and just expose a final field? EDIT: I don't think this is actually the right forum as I think this is a discussion point rather than an answer after evaluating the perspectives.


title: Having an inherited function return the derived type instead of the base type

text: I am writing two classes in C#:   * A `Matrix` class that represents a general Matrix with n-by-m dimensions    * A `SquareMatrix` class that inherits from `Matrix` and has the constraint of being n-by-n The reason I designed it this way is because square matrices support additional specific operations like calculating the determinant or the inverse, so being able to guarantee that those functions are avaliable with the specific type you're using are nice things to have. Additionally it would support all the regular Matrix operations and can be used as a Matrix I have a function in `Matrix` called `getTranspose()`. It calculates the transpose of the Matrix and returns it as a new `Matrix` I inherited it in `SquareMatrix`, but because the transpose of a square matrix is guaranteed to be square matrix, I also want it to return a `SquareMatrix` I am unsure about the best way to do this.   * I can re-implement the function in `SquareMatrix`, but that would be code duplication because it's essentially the same calculation   * I can use implicit typecast operators, but if I understand correctly that would cause unnecessary allocations (upcast `SquareMatrix` to `Matrix`, create a new `Matrix` as the transpose, create a new `SquareMatrix` during typecasting and throw away the tranposed `Matrix`)   * I can use explicit typecast operators, but it would be stupid to have to typecast the transpose of a `SquareMatrix` explicitly, and it also has the same problem of the implicit operator with unnecessary allocations Is there another option? Should I change the design of having `SquareMatrix` inherit from `Matrix`? This problem also applies to operators. It seems that I have to either implement typecasting operators which might cost in performance, or have to re-implement the same code.


title: Should I take a job working with an esoteric language?

text: How worthwhile is it to take a job that will mainly involve working with an esoteric or niche language? Will this limit my prospect of moving back into languages that I prefer working with later in my career, or will the general experience of working in a software engineering job be enough? I suppose this question could be rephrased as: how much do employers care about specific language experience, as opposed to general programming experience and aptitude?


title: Design Patterns (java) -- Strategy with fields. Ever acceptable?

text: Both here on stack overflow and on Java Effective it is suggested that strategy design patterns should be stateless. In fact in the book it is also suggested to make each strategy object a singleton. The problem I have is that some strategies I envision for my program need states/fields. Either because they are path-dependent in their behavior or because I want them heterogeneous (a statistical distribution of similar strategies, if you prefer).   This forces me to break both Java Effective suggestions: I instantiate a new strategy for each user class AND each of these strategies contain its own fields.   Is that very bad? Should it be done differently? It was suggested to me to keep the fields that make the strategy heterogeneous in the class that uses it and then pass it as an argument. I find that very anti-oo. Those fields don't belong to the user class. In fact, if that class uses another strategy it might not need those fields at all. That seems to run against the reason I am using the strategy pattern in the first place.   Mostly I am just very confused * * * I make a simple example here. Imagine you have a class Gambler, which represents somebody making bets on horses. Now this class will require a strategy predictStrategy that will work something like this:               interface predictStrategy{         public Horse predictWinningHorse(HorseRace r);     }      Now, I can have many implementations where the strategy is to choose at random, or pick the white horse or whatever. That's easy.   Imagine though that I implement a strategy that looks at past predictions and somewhat "learns" from its past mistakes. Clearly each strategy will have to have its own memory on which to learn. I might have to add one more method to the interface (or make an extension)               interface predictStrategy{         public Horse predictWinningHorse(HorseRace r);              public void addObservation(HorseRace r, Horse oldPrediction, Horse actualWinner);     }      So that the Gambler class calls "strategy.addObservation(...)" at the end of each race to improve its predictive power.   Can this be **really** be done with a _stateless_ strategy object? It seems impossible to me.


title: Handling recurring cURL POST request

text: I've basically came here for some advise based on my criteria, The application I'm trying to build is built completely from an API. It's like a "marketplace bidding" application, what I'm trying to accomplish is an "Auto bidding" function, but for this to happen it will have to send a cURL POST request every 3 seconds based on criteria given, then return the JSON result for me to handle server side, I'd basically like a direction on what would be the best way to handle this kind of idea, I got told something called "polling" would work but I've never heard of it. Initially the idea is as provided below   1. Load set page "bid.php"   2. Enter certain criteria   3. Click submit as to which an "Ajax" request of some sort would start   4. The recurring cURL request would be activated through the Ajax.   5. Display the data back from the cURL request every 3 seconds via Javascript. I'm not initially asking for the work to be given to me, I'm just asking the professionals as to which they recon would be the best way I can do this task.


title: What should we tell our unsupported IE6 users?

text: In the upcoming version of our web app, we've broken IE6, and we don't intend to fix it. We've had a clear warning posted for IE6 users for some months; we've decided it's time not to support it. My question is: how should we communicate this to our users? Some people here feel that we should block IE6 users who would try to access the web app, because it's not going to work for them. Others feel that we should just leave up a warning, saying "This doesn't work in IE6," but not block them; instead, if they click to dismiss the warning, just let them in to the broken site to see for themselves that it doesn't work. Who is right? Is there a better way?


title: Simplest possible Paxos algorithm (distributed consensus) explanation

text: I am looking for a simple explanation of the **Paxos algorithm** that can be used for reaching consensus in a distributed environment (possibly peer to peer network). Every explanation I have encountered so far was a tough reading of multiple pages. I am looking for a simplified explanation that still preserves the core principles.


title: How do I prove or disprove "god" objects are wrong?

text: **Problem Summary:** Long story short, I inherited a code base and a development team I am not allowed to replace and the use of God Objects is a big issue. Going forward, I want to have us re-factor things but I am getting push-back from the teams who want to do everything with God Objects "because its easier" and this means I would not be allowed to re-factor. I pushed back citing my years of dev experience, that I'm the new boss who was hired to know these things, etc, and so did the third party offshore companies account sales rep, and this is now at the executive level and my meeting is tomorrow and I want to go in with a lot of technical ammo to advocate best practices because I feel it will be cheaper in the long run (And I personally feel that is what the third party is worried about) for the company. My issue is from a technical level, I know its good long term but I'm having trouble with the ultra short term and 6 months term, and while its something I "know" I cant prove it with references and cited resources outside of one person (Robert C. Martin, aka Uncle Bob), as that is what I am being asked to do as I have been told having data from one person and only one person (Robert C Martin) is not good enough of an argument. **Question:** What are some resources I can cite directly (Title, year published, page number, quote) by well known experts in the field that explicitly say this use of "God" Objects/Classes/Systems is bad (or good, since we are looking for the most technically valid solution)? **Research I have already done:**   1. I have a number of books here and I have searched their indexes for the use of the words "god object" and "god class". I found that oddly its almost never used and the copy of the GoF book I have for example, never uses it (At least according to the index in front of me) but I have found it in 2 books per the below, but I want more I can use.   2. I checked the Wikipedia page for "God Object" and its currently a stub with little reference links so although I personally agree with that it says, it doesn't have much I can use in an environment where personal experience is not considered valid. The book cited is also considered too old to be valid by the people I am debating these technical points with as the argument they are making is that "it was once thought to be bad but nobody could prove it, and now modern software says "god" objects are good to use". I personally believe that this statement is incorrect, but I want to prove the truth, whatever it is.   3. In Robert C Martin's "Agile Principles, Patterns, and Practices in C#" (ISBN: 0-13-185725-8, hardcover) where on page 266 it states "Everybody knows that god classes are a bad idea. We don't want to concentrate all the intelligence of a system into a single object or a single function. One of the goals of OOD is the partitioning and distribution of behavior into many classes and many function." -- And then goes on to say sometimes its better to use God Classes anyway sometimes (Citing micro-controllers as an example).   4. In Robert C Martin's "Clean Code: A Handbook of Agile Software Craftsmanship" page 136 (And only this page) talks about the "God class" and calls it out as a prime example of a violation of the "classes should be small" rule he uses to promote the Single Responsibility Principle" starting on on page 138. The problem I have is all my references and citations come from the same person (Robert C. Martin), and am from the same single person/source. I am being told that because he is just one guy, my desire to not use "God Classes" is invalid and not accepted as a standard best practice in the software industry. Is this true? Am I doing things wrong from a technical perspective by trying to keep to the teaching of Uncle Bob? **God Objects and Object Oriented Programming and Design:** The more I think of this the more I think this is more something you learn when you study OOP and it's never explicitly called out; Its implicit to good design is my thinking (Feel free to correct me, please, as I want to learn), the problem is I "know" this, but but not everybody does, so in this case its not considered a valid argument because I am effectively calling it out as universal truth when in fact most people are statistically ignorant of it since statistically most people are not programmers. **Conclusion:** I am at a loss on what to search for to get the best additional results to cite, since they are making a technical claim and I want to know the truth and be able to prove it with citations like a real engineer/scientist, even if I am biased against god objects due to my personal experience with code that used them. Any assistance or citations would be deeply appreciated.


title: Would it be bad design to abstract a graphics library and wrap it in a single class?

text: I'm starting a game project in C++ using the SFML. It provides various classes for handling graphics, input, etc, but I would like to wrap it all up in a single `Media` class. I believe that by doing so, I could simplify my effort and have the class take care of the details, limiting the amount of code I have to write and therefor limiting chances for a bug to sneak past my eyes. However, I have read several times that monolithic, do-it-all classes such as this might not be a good idea. Why is that?


title: Can I release a script that depends on both proprietary and GPL'd libraries to be run?

text: I'm writing my thesis project in GNU Octave. My project basically consists of a bunch of ".m" files that are written in Octave. I'm also using a proprietary (and unreleased) shared library developed by my supervisor. To be able to access the library, I've written an OCT-file wrapper (dynamic extension for Octave). My question is: am I allowed to distribute my ".m" files that depend on both Octave internals and the proprietary library? I'm not going to distribute any dependencies nor the wrapper files, just the ".m" files. Is it illegal to distribute these (I don't mind being forced to release them under a specific license) if they depend on a proprietary piece of software to be fully functional? Even if it's just to document my experiments? I've already asked at the Octave forums, but they were too passionate and aggressive and didn't give any useful arguments. I would like to hear facts, not ideology. PS: I know I could use MEX, which is the only explicitly allowed means of communication with proprietary libraries in Octave. However, it's not possible for technical reasons to use MEX in my case.


title: What's best practice for a SELECT * FROM SQL in PHP?

text: I need to make a "SELECT * FROM" Sql from PHP, that now returns about 10.000 records, that I insert in an Array and re-utilize in a page to show results in a table. I need to have all that elements also in a hidden input fields, to connect via API to a SMS service to send SMS               <input type="hidden" id="destinatariSMS" name="destinatariSMS" value="<?php echo htmlentities(serialize($destinatariSMS)); ?>" />      Obviously, with 10k elements loading of page is about 10-15 seconds (in a VPS with 2GB ram). I'm worrying because in about two months element will be 12-13k, about 1k elements at the month. I cannot paginate elements because I need all together in that input... In your opinion, what's best practice to no "destroy" VPS or browser? Thank you very much


title: Is it ever a good idea to use the design pattern name in the implementing classes?

text: Recently I came across a moderately large python codebase with lots of `MyClassAbstractFactory`, `MyClassManager`, `MyClassProxy`, `MyClassAdapter` etc. classes. While on the one hand those names pointed me to research and learn the corresponding patterns, they were not very descriptive of what the class **does**. Also, they seem to fall within the forbidden list of words in programming: `variable`, `process_available_information`, `data`, `amount`, `compute`: overly broad names, that don't tell us anything about the function **when used by themselves**. _So should there be`CommunicationManager` or rather `PortListener`? Or maybe I do not understand the problem at all...?_


title: Should I migrate to MVC3?

text: I have a MVC2 project, my question is: should I migrate to MVC3? Why? I'd like the opinion of some who already migrated, or at least used MVC3 and MVC2. Already read http://weblogs.asp.net/scottgu/archive/2011/01/13/announcing- release-of-asp-net-mvc-3-iis-express-sql-ce-4-web-farm-framework-orchard- webmatrix.aspx and I already know about the described tool for migrating: http://blogs.msdn.com/b/marcinon/archive/2011/01/13/mvc-3-project-upgrade- tool.aspx What I'd really appreciate is your valuable insight. Best regards.


title: Start a new project. Where is the inspiration?

text: _The question may seem strange at first glance_ ... And **I may be alone** in this situation. But currently I want to improve my skill through learning new framework. however, do a simple "`HelloWorld`" application does not satisfy me. I think a **practical project** is required to apprehend the basics of a framework. I know there is many scholar-like project like design a library manager or CMS. But I have recently planned to learn ~3 differents frameworks and I can't find any motivations through " _unexciting_ " project. In the end I have not started any framework ... I'm aware of _I do not develop the project of the year_ ... I'm just looking for something **a bit exciting**. **I do not expect any project subject** , anyway stimulation provided by a project is something subjective. But I want to know your inspiration ! (or method to learn framework ^^) I'm talking about web-dev framework but I'm open to any kind information !


title: Is a senior programmers advice about always using books a good idea?

text: I am a junior developer and have only been in the industry for 5 years. At my current company there is a senior let's call him Infestus. Occasionally I am being given opportunity to shine and do something completely brand new from scratch. One of the most recent examples was that I had to make a singleton in the multithreaded application. I have decided to use this method. As soon as Infestus saw it, he quickly proceeded to call me stupid and told me to use this approach. Upon asking him why he just brushed it off as this is better and that's how this and this book about java says it is better. And it is a common pattern, whenever I get a chance to do something new, I quickly get shot down by Infestus and the only reasoning why his method is books written by famous programmers. He is always trying to give me books to read so that I may "learn" which ways to program. I have only been programming for money for 5 years, but is it always a good idea to just blindly follow the book on best ways for solving a problem, or should I try experimenting every now and then? The constant barrage of complaints from the Infestus is starting to cause me to never try anything new and follow examples in books. EDIT: I am utterly lost. Yes I know that following anything blindly is a bad idea. But this godlike programmer Infestus who seems to know a lot, tells me that the only way to program properly is by reading books and following everything down to a T. All the rules he imposes are the ones written in books, so I am just wondering if books are the only correct way. EDIT2: Infestus is not my boss. He is just one of senior developers in charge of reviewing the code. And most of his comments after reviews consist of book names where such and such method is wrong.


title: Unit Test - an Enigma?

text: I am an objective-c/iOS apps developer and I was wondering if I perform Unit Tests on my code, how should I go about it? What is unit test anyway? Ain't I testing a specific part of code while running the whole app itself? What is its use? I have read few articles, wikipedia etc. but I am not sure whether unit testing is a time consuming or a time saving process. I know the definition but I am in the dilemma about its purpose. Plz guide a new bee here. :) Have already gone through the following: Unit testing best practices for a unit testing newbie


title: How would I go about changing encryption methods on existing passwords?

text: If I have an application that is using a less secure method for storing passwords, such as SHA-1, how would I go about converting to SHA-256 or SHA-512?


title: How can I move from Java and ColdFusion to Ruby on Rails?

text: Currently I work with ColdFusion 9+ and some Java in a Windows environment. Prior to ColdFusion, my background was in Java and JSP. I'm considering a move towards Ruby on Rails, as I think it would be a real challenge, keep things fresh, and provide more job opportunities. In order to get into it, I started to build my personal website in Rails 3.0. But what else can I do to make this transition from what I know now to Ruby and Rails? Are there specific or idiomatic aspects of Ruby or Rails I should keep in mind when switching over from a ColdFusion and Java mindset?


title: Alternatives to the repository pattern for encapsulating ORM logic?

text: I've just had to switch out an ORM and it was a relatively daunting task, because the query logic was leaking everywhere. If i'd ever had to develop a new application, my personal preference would be to encapsulate all query logic (using an ORM) to futureproof it for change. Repository pattern is quite troublesome to code and maintain so i was wondering if there are any other patterns to solve the problem ? I can foresee posts about not adding extra complexity before it's actually needed, being agile etc. but i'm only interested about the existing patterns solving a similar problem in a simpler way. My first thought was to have a generic type repository, to which i add methods as needed to specific type repository classes via extension methods, but unit testing static methods is awfully painful. IE:               public static class PersonExtensions     {         public static IEnumerable<Person> GetRetiredPeople(this IRepository<Person> personRep)         {             // logic         }     }


title: What is the justification for Python's power operator associating to the right?

text: I am writing code to parse mathematical expression strings, and noticed that the order in which chained power operators are evaluated in Python differs from the order in Excel. From http://docs.python.org/reference/expressions.html: _"Thus, in an unparenthesized sequence of power and unary operators, the operators are evaluated from right to left (this does not constrain the evaluation order for the operands): -1_ *2 results in -1."* This means that, in Python: `2**2**3` is evaluated as `2**(2**3) = 2**8 = 256` In Excel, it works the other way around: `2^2^3` is evaluated as `(2^2)^3 = 4^3 = 64` I now have to choose an implementation for my own parser. The Excel order is easier to implement, as it mirrors the evaluation order of multiplication. I asked some people around the office what their gut feel was for the evaluation of `2^2^3` and got mixed responses. Does anybody know of any good reasons or conciderations in favour of the Python implementation? And if you don't have an answer, please comment with the result _you_ get from gut feel - `64` or `256`?


title: Understanding the levels of computing

text: Sorry, for my confused question. I'm looking for some pointers. Up to now I have been working mostly with Java and Python on the application layer and I have only a vague understanding of operating systems and hardware. I want to understand much more about the lower levels of computing, but it gets really overwhelming somehow. At university I took a class about microprogramming, i.e. how processors get hard-wired to implement the ASM codes. Up to now I always thought I wouldn't get more done if learned more about the "low level". One question I have is: how is it even possible that hardware gets hidden almost completely from the developer? Is it accurate to say that the operating system is a software layer for the hardware? One small example: in programming I have never come across the need to understand what L2 or L3 Cache is. For the typical business application environment one almost never needs to understand assembler and the lower levels of computing, because nowadays there is a technology stack for almost anything. I guess the whole point of these lower levels is to provide an interface to higher levels. On the other hand I wonder how much influence the lower levels can have, for example this whole graphics computing thing. So, on the other hand, there is this theoretical computer science branch, which works on abstract computing models. However, I also rarely encountered situations, where I found it helpful thinking in the categories of complexity models, proof verification, etc. I sort of know, that there is a complexity class called NP, and that they are kind of impossible to solve for a big number of N. What I'm missing is a reference for a framework to think about these things. It seems to me, that there all kinds of different camps, who rarely interact. The last few weeks I have been reading about security issues. Here somehow, much of the different layers come together. Attacks and exploits almost always occur on the lower level, so in this case it is necessary to learn about the details of the OSI layers, the inner workings of an OS, etc.


title: Suggestions needed on an architecture for a multiple clients and customisable web application

text: Our product is a web based course managemant system. We have 10+ clients and in future we may get more clients. (Asp.net,SQL Server) Currently if one of our customers need extra functionality or customised business logic, we will change the db schema and code to meet the needs. (we only have one branch code base and one database schema) To make the change wont affect each others route, we use a client flag, which defined in a web config file, thus those extra fields and biz logic only applied to a particular customer's system.               if(ClientId = 'ABC')     {        //DO ABC Stuff     }     else     {        //Normal Route     }      One of our senior colleagues said, in this way, small company like us can save resources on supporting multiple resources. But what I feel is, this strategy makes our code and database even harder to maintain. Anyone there crossed similar situation? How do you handle that?


title: Should a programmer "think" for the client?

text: I have gotten to the point where I hate requirements gathering. Customer's are too vague for their own good. In an agile environment, where we can show the client a piece of work to completion it's not too bad as we can make small regular corrections/updates to functionality. In a "waterfall" type in environment (requirements first, nearly complete product next) things can get ugly. This kind of environment has led me to constantly question requirements. E.G. Customer wants "automatically convert input to the number 1" (referring to a Qty in an order). But what they don't think about is that "input" could be a simple type-o. An "x" in a textbox could be a "woops" not I want 1 of those "toothpaste" products. But, there's so much in the air with requirements that I could stand and correct for hours on end smashing out what they want. This just isn't healthy. Working for a corporation, I could try to adjust the culture to fit the agile model that would help us (no small job, above my pay grade). Or, sweep ugly details under the rug and hope for the best. Maybe my customer is trying to get too close to the code? How does one handle the problem of "thinking for the client" without pissing them off with too many questions?


title: Separating java projects

text: I have a large java project, and we use maven for our build cycle. This one project is used extensively - in other projects, in various applications, some of which are contained in it and some which are elsewhere... To be honest, it's a bit of a mess (various bits added on at different times for specific purposes), and I'd like to clean it up a bit. Also, it's not fully tested (lots of bits have been added on without proper unit and integration testing), and there are some tests that take a long time to run or don't actually pass... (uh-oh) - so tests are switched off in the maven build cycle (again, uh-oh). I am thinking about separating this large project into smaller specific projects, such that the 'final' sub-project (or several sub-projects) would pick up the various sub-projects that it would need. My thinking is as follows:   * if I separate the big project into various sub-projects, this makes it clear what each project's responsibility is.    * by separating into sub-projects, I can then clean up the testing of each sub-project individually, and turn on the testing for that sub-project in the maven build cycle. I am slightly concerned about what impact this might have on the build time.   * Would imposing a structure on the large project (i.e. into smaller sub-projects) slow the compiler down? Also, I have a slight concern on what impact this might have editing time in IDEs (we principally use Intellij). Intellij seems to build each project in turn through the dependency tree - i.e. if C depends on B depends on A, and I change A, it won't try to build B unless A compiles, and so on. Arguably that's advantageous, but I have found that if - for example, I change an interface in A that is widely used in B and C, it takes some time to fix all the errors from that change... Another question is how to use factory classes. Some aspects of the project depend on external jars. Occasionally (thankfully not often) these are updated, and we have to migrate. We tend to handle this by using a Factory class which points to the correct versions of the external code (so we don't have to change all the implementations throughout the code base). At the moment this is all in the large project, but I am thinking that by switching to sub- projects, I could develop a new project for the implementation of new external code, make sure that sub-project is fully functional and tested, and then switch the dependencies / factory class in the user project. However, this is made more complicated by the extensive use of interfaces throughout the large project. For example   * sub-project A - contains interfaces   * sub-project B - depends on A for interfaces and old external jar   * sub-project C - depends on B (and thus A and old external jar), and contains a Factory class that uses B's implementations of interfaces If I need to change the external jar of B, I can:   * create sub-project B_ii - again depends on A, and now the new external jar   * once fully functional, I can add C's dependency to B_ii, and change the Factory class to use the new implementations of interfaces.   * when that's all working, I can then remove C's dependency to original B, and if desired, remove sub-project B.   * Is that a sensible way of going about this?  So, in general, my questions are:   * Does anyone have any experience of breaking up large projects? Are there any tips/tricks that you would be willing to share?   * What impact did this have on your development and build times?   * What advice could you offer on structuring such a break-up of such a project?


title: Most recent vs Most used

text: We are building a business application (a laboratory management system to be more precise) mostly for internal company use only. To make it easier for users to find items which they work on we are implementing a list of most used items. We had a little debate on which method would be better to implement: display the most recent vs display the most used. **My arguments on most-recent**   * A little bit easier to implement. I think this is worth to mention because we are dealing with business application which will be sold as a single copy, so this may directly effect application price. Also simpler implementation means less code and may effect maintenance code.      * Counterargument: difference in implementation difficulty in this case is too small   * It is easier for users to guess what will they find in this list so they know if it is worth to look at the list at all.   * Items which were relative yesterday and used a lot might not be relevant today and in recent item list they quickly disappear. **My arguments on most-used**   * Actually it is quite easy to display a mixed version of recently-used and most-used by combining last access date and a number of access something like this `(today - lastaccess) * number_of_access`     * Counterargument: this requires fine-tuning What arguments would you give for one or another?


title: Why do exclusively outsourcing projects as a company?

text: A prospective employer told me they took a company level decision to do only outsourcing projects. I do not understand why they took such a decision and the guy I talked to did not elaborate. He further said only that "their intention is to build software components". Since they are growing quite fast and reached around 300 employees, shouldn't they be at least open to the possibility of having a project of their own, maybe? All other companies I've had contact with were at least open to have one in the future. I talked to a few of their employees and some are working in parallel on more than 2 outsourced projects (dividing time something like 4 + 4 hours / day). It seemed like a lot of projects with a period of a few months, maybe half a year come and go. Why would a company choose to provide only outsourcing services like that? How does it work to keep hundreds of people on outsourced projects with a seemingly high project turnover rate?


title: Why was the Java App store discontinued?

text: A Java App Store sounds like a cool idea right? Well, I turned to Google and found some remnants of an app store that Oracle had been developing. It looks like it has since been discontinued, but I haven't been able to find much commentary on why it was abandoned. So why was it discontinued? Links to other references, for instance blog posts discussing the difficulties of Oracle's app store, would be much appreciated.


title: Entity Framework book 1st Edition

text: I recently purchased the O'Reilly book: Programming Entity Framework by Julia Lerman. Unfortunately it is the 1st edition. I didn't realize that there was a newer edition. Which in hind sight explains the lessor price for the book. So my question... Should I return it and get the 2nd edition or read the 1st edition? The 1st edition spends a lot of time in the version 1 of the EF and the 2nd edition spends a lot of time in version 2 (which is where I want to be). I think I want to return it, but I thought I would ask the question first... Thoughts?


title: How much documentation should a client expect from a one-man team?

text: I work for a small electronics and support software company that just recently got a contract with a large company that's very strict on documentation (I do the support software, essentially Windows or browser applications). Upon reviewing the required documentation from the large company, I realize that I wear more hats than I realized. Namely, we have to produce documentation describing:   * Requirement analysis (me)   * Architectural design (me)   * Detailed design (me)   * (Actual) Software development (me)   * Database design development (me)   * Testing plan, preparation, and results (me)   * Proof of compliance with requirements (me)   * User manual (me) I'll also be doing most (if not all) of the testing myself. And the deployment, training, and customer support. If there's any application technician needs for sales support, that's me too. Is that common? Do small software companies that get big contracts ask that commonly from single programmers?


title: By what features and qualities are "free" and "premium"  themes differentiated

text: I have a lot of time invested in creating Wordpress templates. I want to release combinations of these templates along with different styles and Fancy Front pages as "Premium Wordpress Themes". What I need to know is what does "Premium" mean? What do people expect of a GPL theme vs. a Premium theme? Are there features that are considered required to be premium? Are there features that are in demand but considered "exceptional" i.e. not part of every premium theme? How can I tell the difference? I have heard tounge-in-cheek answers that say that any theme that makes money is premium, but I mean to ask about what gives an outstanding theme it's quality. Why is it worth more? I am technically able to do many things, but as a lone developer with a family to feed, I can't afford to spend time on features that no one cares about. I have to try to isolate the things that people want. This is serious food and rent to me. How can I get this kind of info so I can make my project successful?


title: What is jQuery and JavaScript's role in MVC?

text: I'm not sure I understand the role of jQuery/JavaScript in MVC. I've found an article about it on _A List Apart_ , but it doesn't clear anything up for me. Does it bridge the communication between the View and the Controller, or does it do something else?


title: ASP.Net MVC or Web Forms?

text: > **Possible Duplicate:**   >  Why would you use MVC over Web Forms? What is the difference between ASP.Net MVC and Web Forms? Is either preferable? I want to use ASP.Net development as a springboard to teach myself C#. What is the best way to go about this?


title: Salesforce trigger Prevent duplication

text: I have written a trigger which prevent duplicate name. please refer following condition. " **Test** " and " **Te st** " are same name (which mean don't need to consider any in between spaces.) " **TEST** " and " **test** " are same name (which mean ignore uppercases and lower cases.) My Question : If I have already one record inserted in system with name " **Te st** ". and Now I am trying to insert a new record with name " **test** "(which is obvious not correct as per duplication). How can i handle this exception? Thank you in advance.


title: Is renaming a program considered modifying a program legally?

text: If a software license prevents you from modifying a program (i.e "You may not modify…") is renaming the program (e.g. changing it from a.exe to b.exe) considered modification legally of the software if the software remains binary identical since all that has really changed is the path to the program? Edit. I am not asking for legal assistance here I am asking what is the case law in this area. What modification is must have been dealt with at some point.


title: Git collaboration with pull request in a company

text: I am thinking of a way to do collaboration between coders in a company, suppose we have 2 type of servers: Production and Staging. Now we want to review all changes going to Production via pull-request, at the same time, we want coders to be able to push experimental changes whenever they want to Staging. The objective here is make sure our guys can do experimental stuff and can't (accidentally) mess up with Production. My idea is to just create 2 separate repository for Production (read-only) and Staging (read-write). Will this be the ideal setup? Any other types of setup I should be aware of? ![enter image description here](http://i.stack.imgur.com/KhtPf.png)


title: In Java, what are some good ways to separate APIs from implementation of *entire projects*?

text: Imagine you have a software module, which is a plugin to some program (similar to Eclipse) and you want it to have an API which other plugins can call. Your plugin is not freely available, so you want to have a separate API module, which _is_ freely available and is the only thing other plugins need to directly link to - API clients can compile with only the API module, and not the implementation module, on the build path. If the API is constrained to evolve in compatible ways, then client plugins could even include the API module in their own jars (to prevent any possibility of `Error`s resulting from nonexistent classes being accessed). Licensing is not the only reason to put API and implementation in separate modules. It could be that the implementation module is complex, with myriad dependencies of its own. Eclipse plugins usually have internal and non- internal packages, where the non-internal packages are similar to an API module (both are included in the same module, but they could be separated). I've seen a few different alternatives for this:   1. The API is in a separate package (or group of packages) from the implementation. The API classes call directly into implementation classes. The API _cannot_ be compiled from source (which is desirable in some uncommon cases) without the implementation. It is not easy to predict the exact effects of calling API methods when the implementation is not installed - so clients will usually avoid doing this.              package com.pluginx.api;     import com.pluginx.internal.FooFactory;     public class PluginXAPI {         public static Foo getFoo() {             return FooFactory.getFoo();         }     }        2. The API is in a separate package, and uses reflection to access the implementation classes. The API can be compiled without the implementation. The use of reflection might cause a performance hit (but reflection objects can be cached if it's a problem. It is easy to control what happens if the implementation is not available.              package com.pluginx.api;     public class PluginXAPI {         public static Foo getFoo() {             try {                 return (Foo)Class.forName("com.pluginx.internal.FooFactory").getMethod("getFoo").invoke(null);             } catch(ReflectiveOperationException e) {                 return null;                 // or throw a RuntimeException, or add logging, or raise a fatal error in some global error handling system, etc             }         }     }        3. The API consists only of interfaces and abstract classes, plus a way to get an instance of a class.              package com.pluginx.api;     public abstract class PluginXAPI {         public abstract Foo getFoo();              private static PluginXAPI instance;         public static PluginXAPI getInstance() {return instance;}         public static void setInstance(PluginXAPI newInstance) {             if(instance != null)                 throw new IllegalStateException("instance already set");             else                 instance = newInstance;         }     }        4. The same as above, but the client code needs to get the initial reference from somewhere else:              // API     package com.pluginx.api;     public interface PluginXAPI {         Foo getFoo();     }          // Implementation     package com.pluginx.internal;     public class PluginX extends Plugin implements PluginXAPI {         @Override         public Foo getFoo() { ... }     }          // Client code uses it like this     PluginXAPI xapi = (PluginXAPI)PluginManager.getPlugin("com.pluginx");     Foo foo = xapi.getFoo();        5. Don't. Make clients link directly to the plugin (but still prevent them from calling non-API methods). This would make it difficult for many other plugins (and most open source plugins) to use this plugin's API without writing their own wrapper.


title: File reading in front end

text: Is there any way to ready a file @ the front end itself, which should be supported for IE 8 and IE 9 also. Please provide any suggestions available for this. Looking for code to read an excel file on the front end/javascript code.


title: Rename PDF extracted Pages File from a Single Booklet PDF in correct sequence

text: I have huge PDF files which are in booklet format. example, Assume a booklet pdf file has 24 pages which each page contains 2 pages which is in two sides - left side and right side. The first page has 48th page number on the left side and 1st page number on the right side The second page has 2nd page number on the left side and 47th page number on the right side The third page has 46th page number on the left side and 3rd page number on the right side I have vertically cut the Booket PDF files in to separate individual PDF files using bulk operation in separate folder. for example, the cutted PDF file will be as follows in the above case 1st pdf file - 48th page 2nd pdf file - 1st page 3rd pdf file - 2nd page 4th pdf file - 47th page 5th pdf file - 46th page 6th pdf file - 3rd page.. Similarly for other PDF files too....if a PDF file has 95 pages.... the first page has 95th page number on the left side and 1st page number on the right side Now the issue is how to rename and arrange the files correctly in the sequence for EACH PDF file so that we can merge the PDF file as one at last for each PDF file... After renaming correctly in the proper sequence for the above file 1st pdf file should point to 1st page 2nd pdf file should point to 2nd page 3rd pdf file should point to 3rd page... The problem is all the PDF files which we are planning to split will have different set of pages..example PDF1 file - has 48 pages as above -> files should be renamed and arranged as 1, 2, 3, 4...48 correctly PDF2 file - has 96 pages -> files should be renamed and arranged as 1, 2, 3, 4.....96 correctly PDF3 file - has 56 pages -> files should be renamed and arranged as 1, 2, 3, 4.....56 correctly After renaming, the final file will be as follows 1st pdf file - should be pointed to 1st page..i.e 2nd pdf file name should be renamed as 1st pdf file 2nd pdf file - should be pointed to 2nd page i.e 3rd pdf file name should be renamed to 2nd pdf file 3rd pdf file - should be pointed to 3rd page i.e 6th pdf file name should be renamed to 3rd pdf file Could someone help me with a program which will rename the vertically cutted files in a proper sequence?? Thanks in advance.


title: Why is the use of conjunctions in method names a bad naming convention?

text: In my team, we work closely with a few software architects. They approve all design decisions of our projects, do some code reviews etc. Our projects consist mainly of backend functionality implemented in PHP using the Symfony 2 framework. So syntactically, the code, naming conventions and project structure look almost identical to what Java would look like (Symfony 2 encourages such structure). I'm mentioning this because Java-specific conventions also apply in our case (if possible). Recently, they suggested something that I find very strange: all methods should have conjunctions in their name e.g. `getEntityOrNull`, `setValueOrException` etc. Such a naming convention feels very wrong to me, but I can't come up with any concrete arguments or online articles/pages that specifically challenge this. The only things I came up with is:   * such information should be present in the method's annotations, like `@return` or `@throws`   * the use of conjunctions ("and", "or" etc.) in method names usually suggest that the Single Responsibility Principle is not properly respected What are some other concrete arguments against this naming convention?


title: This program in Java doesn't stop executing!

text: I have written this program but it doesn't stop executing. Can you help me with it?               /*      * To change this license header, choose License Headers in Project Properties.      * To change this template file, choose Tools | Templates      * and open the template in the editor.      */          package inplacesort;          import java.util.*;     /**      *      * @author ASUS      */     public class InplaceSort      {         static Scanner console = new Scanner(System.in);              /**          * @param args the command line arguments          */         public static void main(String[] args)         {             Vector <Integer> intList = new Vector <Integer> ();                  //getting the numbers from the user             char ans = 'y';                  while (ans == 'Y' || ans == 'y')             {                 System.out.print("Enter a Number: ");                 intList.addElement(console.nextInt());                      System.out.print("Do You Want to Continue?(Y/N)");                 ans = console.next().charAt(0);             }             System.out.println(intList);             for (int i = 1; i < intList.size(); i++)             {                 //if (intList.elementAt(i) < intList.elementAt(i-1))                 //{                 int j = i - 1;                 while (j > 0 && intList.elementAt(i) < intList.elementAt(j))                 {                     j--;                 }                      for (int k = intList.size() - 1; k >= j; k--)                 {                     intList.insertElementAt(intList.elementAt(k),k + 1);                 }                      intList.insertElementAt(intList.elementAt(i+1),j);                 intList.removeElementAt(i+1);                 //}             }             System.out.print(intList);         }     }


title: Is it possible to port a python desktop app(command line) into cloud

text: I am new to python and cloud computing . As part of my new project i am planing to port a python desktop application(command line) to cloud. is it possible


title: The Next Step, from Senior Developer to Architect

text: **A little background:** Bachelor In Engineering, Master Degree in Comp Sci. Landed junior dev straight out of Uni. 2 years later, left for Senior Dev. Now planning next step... Platform: _.NET, VB,C# (upto 4.0, LINQ, PLINQ) ,F#,Winform,ASP.NET+(usual web tech,js,xslt, dxhtml,etc),WPF, db ->MS T-SQL_ **Question:** What are the next steps I should be thinking about if my goal is to become a .NET Architect? What things do I need to gain experience in, both soft skills + technical. What is the fastest route there? Are there any advice in general related to becoming a Architect? Thanks in advanced.


title: Managing code changes in this coding environment

text: I have the following coding environment:   * Three Developers   * Source code resides in Team Foundation Server (2010)   * Development Environment   * Stage Environment   * Production Environment As the Senior Developer, I need to review code before its pushed to the Staging Environment. Once I review the code, it is pushed to Stage where it gets tested by our (small) test team. Once changes are tested and accepted, I move to production. Suppose the following: `Developer A` submits a change, I review it and push to stage. `Developer B` submits a change, I review it and push to stage. During the testing, a user says the change `Developer A` made has bugs and needs to be fixed. But the changes `Developer B` made need to go to production. This happens more than not. Currently, I need to wait for `Developer A` to fix the bugs and test again or have `Developer A` disable their changes. How to solve this dilemma?


title: What are the disadvantages of naming things alphabetically?

text: Let me give you an example of how I name my classes alphabetically:   * Car   * CarHonda (subclass of Car)   * CarHondaAccord (subclass of CarHonda) There are two reasons why I put the type of the class earlier in its name:   1. When browsing your files alphabetically in a file explorer, related items appear grouped together and parent classes appear above child classes.   2. I can progressively refine auto-complete in my IDE. First I type the major type, then the secondary type, and so on without having to memorize what exactly I named the last part of the thing. My question is why do I hardly see any other programmers do this? They usually name things in reverse or some random order. Take the iOS SDK for example:   * UIViewController   * UITableViewController What are the disadvantages of my naming convention and the advantages of their convention?


title: Should I add old code into my repository?

text: I've got an SVN repository of a PHP site and the last programmer didn't use source control properly. As a result, only code since I started working here is in the Repo. I have a bunch of old copies of the full code base saved in _files_ as "backups" but they're not in source control. I don't know why most of the copies were saved nor do I have any reasonable way to tag them to a version number. I _do_ have the dates the backups were made, all backups have proper file system timestamps. Due to upgrades to the frameworks and database drivers involved, the old code is quite defunct; it no longer works on the current server configuration. However, the previous programmers had some _unique_ logic, so I hate to be completely without old copies to refer to what on earth they were doing. Should I keep this stuff in version control? How? Wall off the old code in separate Tags/branches?


title: Using BSD and GPL in one project

text: I am an author of project, that consists of two parts: daemon and library. I want to license library under BSD License (or MIT, will decide later), and daemon under GPLv3. I want to permit the library to be linked into closed-source products, but I want daemon to be GPL, as it uses GPL code heavily, and I do not want its commercial forks. The thing is: This library just provides client interface for the daemon, where daemon acts just like sort of server. Is it permitted to license my project using separate licenses for different parts of my project, linked with some sort of RPC protocol?


title: How to pass parameters to a function in C

text: Suppose I'm writing a program in C in which several parameters are asked at the beginning of the execution to the user and then remain costant until the end. Now, I need to pass these parameters to some function. Since they are unchanged through the program, my temptation would be to declare them as global variables, to have them visible to all functions. However, I see that this is not a good practice if the dimension of the program gets big (this has been asked and answered here). However, I neither see the point of creating functions with, say, 6 arguments, when the variable ones are only 2. Is there a more elegant way to do this without compromising too much the manipulability of the code?