Object-Oriented Programming: Why "Oriented"?

I am most of the way through my games programming degree. This is not a computer science degree, so a lot of the theory is eschewed in favour of practical portfolio building and what I see as JIT learning, which is apparently more important in the games industry. The first subject was "Introduction to Object-Oriented Programming". That phrase didn't bother me until I learned about the different programming paradigms (I'm getting this list from https://en.wikipedia.org/wiki/Comparison_of_programming_paradigms):   * Imperative   * Functional   * Procedural   * Structured   * Event-Driven   * Object-Oriented   * Declarative   * Automata-Based I get that this is not an exhaustive list, and that not all of these concepts are equal, and most of them aren't even exclusive, but I don't understand why most of them get just one word - imperative; functional; declarative - but when we talk about programming with objects, we have to clarify that we are _oriented_ around those objects. Can't we just _use_ objects? Can't we just _have_ objects? Why must they _orient_ us, as our guiding star? Looking here (https://en.wikipedia.org/wiki/Object-oriented_programming), nowhere is the use of the term "oriented" addressed as its own term. Only "object" is explained. Also, I can see for practical reasons why Event-Driven is used, because Event Programming is already a thing that you do when you're running a conference, and Automata Programming makes it sound like you're setting up a robotic production line, so it helps to have additional clarifying words there. **What makes Object Programming, as a phrase, not enough to describe what we do when we use objects in our programming?** Obviously from my tone I'm not too fond of the word "oriented". It reminds me of my time as a court reporter, listening to lawyer after lawyer use the phrase "in relation to" as a kind of verbal tick. It didn't mean anything; it was just a term that they used to fill the air while they tried to think of what to say next. However, I'm not trying to advocate a change of language, I'm just asking why it is the way it is. If someone knows why it came to be known that way for purely historical, vestigial reasons, then that's the answer. It will be ammunition if I ever decide to waste my time advocating for a change of language. On the other hand, if there is actually a useful reason for why a language or piece of code must _point_ towards objects, to the exclusion of all other directions, as opposed to merely having them in its toolbelt, as _tools_ , I would really be interested to learn about it. I like learning useful things.


Can REST API be used as business layer?

I am using PHP Codeigniter **MVC** design pattern and I had this project with some sort of specific business processes In my application I will be dealing with 2 existing REST APIs:   1. Google    2. Trello I came up with idea to create **REST API** to act as **Business Logic Layer** (BBL) that in turns access my models directly to fetch needed data to formulate business rules and controller with communicate with BLL with REST client, ![enter image description here](http://i.stack.imgur.com/p5rMQ.png) Is that bad approach for performance ? Is it better to create **2 layers** of Models one as Data Access Layer **(DAL)** and one as Business Logic Layer **(BLL)**


BLL structure and organization

let's say you have a class diagram http://i.stack.imgur.com/gpb55.png and you would like to start a class library project in visual studio to act as BLL to convert this diagram into actual code files. how would you structure your BLL project (in the solution explorer), how would you organize classes files and thier hierarchy?


State pattern long state class names

I am using state pattern on 28 states in my application. The states are for membership cards that has 7 major states, there are 4 boolean attributes for the membership card that actually affects the its behavior so I have decided to embed them with states, that's how it multiplied to 28 states. The problem now is with states class naming, it is getting crazing, I am ending up with class state named like this `Membership-UnderCreation-Printed- Linked-Premium-Frozen` \----- I have hyphened different attributes to make it clear. Is it ok for state class names to be like this?


Preventing Web Users From Using Their Location Bar Within An App

My boss asked me to alter our Java Webapp such that users cannot go to places in our Webapp by typing URLs into their browser location bar. I told her that I can not disable their location bars. I told her the way this is usually done is to launch a WebApp in a new customized browser window sans a location bar. That was not acceptable to her. I already have a Java Filter class set up to enforce various rules. So, I was thinking of this approach   1. Implement a system wide "writeFlagCookie" javascript function to write a cookie anytime a user initiates a GET by clicking on a link or a button.   2. Everywhere the WebApp does a redirect or a forward, put a flag variable, say "wasRedirected" into the HTTP session.   3. In my Filter, intercept each request and check for the request type.   4. If it is a POST, I know a human didn't type the URL into their browser, so I automatically let it through.   5. If it is a GET, look for a javascript generated cookie, or the flag stored in the session to indicate a redirect or a forward. If I find neither send the user back to the page they just tried to leave from. Though it will be a lot of work, it sounds too simple to be adequate. Is there anyway this approach can bite me in the ass? My boss wants two problems solved   1. Users going to screens out of sequence and getting error messages. This includes multi-screen forms ( which we have to keep ) and users using a back button.    2. Preventing the user from leaving particular pages and going to other parts of the application until they fill out what we want them to fill out on those screens. I have ideas how to solve #1 & #2, also laborious, but my boss likes the idea of disabling typing URLs for navigation for a catch-all solution. Maybe once she sees how much work is involved in disabling typed navigation I can market her on just solving those problems. Thanks Steve


how to write a stored procedure to insert data in to a sql server database in a datagridview in a form?

I need to insert data through a form using a `datagridview` connected to a SQL Server 2008 R2 database. is it ok, if I write a single insert stored procedure query in a while loop in the `form.cs`


How difficult did you find the Java Certification Exam

I'm just starting out as a Java programmer and have very minimal experience. I would like to improve my knowledge and study for the Java certification. I realize everyone will have a different answer but for those who have taken the certification and passed it, I'd really appreciate if you could tell me your experiences. Just a couple of lines to let me know if you found it hard, very hard. Also how much time did you spend studying. Sorry that this is not a good question. My native language is not English so it is hard for me to say what I want to ask.


Having 2 Initialize Paragraphs in 1 COBOL program

I am designing a COBOL program that does 2 things.   1 reads specific rows from a table, and inserts a new row based on the original.   2 reads different rows from the same table, and updates those rows. Is it bad standards to have 2 initialization procedures? I need to declare 2 SQL cursors, one for each task. So I was thinking:   `1 initialize cursor, 2 process, 3 initialize cursor, 4 process.` But that seems like bad logic. something is telling me it should be more like:   `1 initialize cursor, 2 process` But I'm having trouble thinking it out because to me, they are 2 separate tasks. I tried to think of a way that my SQL query could do the work, and then I could just do some validation. But I'm not sure the query would be any more efficient than having a second read of the table. Here's my structure ideas   I've added a 3rd chart that I believe follows the answer given to me on this question. Does the 3rd chart seem to me the most logical?


Should I keep all my class definitions in the same class library?

I am starting to work with class libraries in my C# class. We were told to write code that can be used more than one time. Should I keep all my class definitions in one class library for the length of the term, or separate them by project?


Is Objective C a reasonable way to learn C?

I want to learn C but I tend to learn best when I have a project to work on. I've never done iPhone development, so I'm hoping to kill two birds with one stone. Will learning objective c also teach me to program c reasonably well, or are they too dissimilar? EDIT: I'm mostly wondering if objective-c/iphone-development would teach me all the little gotcha's that are inherent to c. I come from a .Net background so I haven't done much in terms of memory management or working with pointers.


Finding maximum number of congruent numbers

Let's say we have a multiset (set with possible duplicates) of integers. We would like to find the size of the largest subset of the multiset such that all numbers in the subset are congruent to each other modulo some m > 1. For example:   1 4 7 7 8 10 for m = 2 the subsets are: (1, 7, 7) and (4, 8, 10), both having size 3.   for m = 3 the subsets are: (1, 4, 7, 7, 10) and (8), the larger set of size 5.   for m = 4 the subsets are: (1), (4, 8), (7, 7), (10), the largest set of size 2.   At this moment it is evident that the best answer is 5 for m = 3. Given m we can find the size of the largest subset in linear time. Because the answer is always equal or larger than half of the size of the set, it is enough to check for values of m upto median of the set. Also I noticed it is necessary to check for only prime values of m. However if values in the set are large the algorithm is still rather slow. Does anyone have any ideas how to improve it?


DDD/SOA in (.NET) MVC and Message pattern(s) / Request Response

We're currently considering whether it makes sense (or if the benefits are worth the added code) to introduce a Message based pattern (such as Request Response) into a Domain Driven Design / Service Oriented Architecture under an MVC app (with DI and potentially used by MVC, WCF, Windows Services, etc.). Basically (in MVC) the controller uses an injected service which in turn uses an injected repository to save/update/delete objects. There are Application Services, and Domain Services and the application service might use multiple domain services to e.g. save something and then send an email about the item being saved. Considering the `example use case` where something is saved and then an email is sent, it could be useful to present any potential errors to the user such as "Save succeeded, but the email wasn't able to be sent. Please try again in 5 minutes or contact support etc." vs just a generic error such as "Save or email didn't succeed". The message based pattern with Request and Response objects seems fine (in theory), or at least the response objects with e.g. a couple inherited fields could be useful.               public abstract class ResponseBase     {         public bool Success { get; set; }         public string Message { get; set; }     }      Then there could be an object to extend it with the ViewModel result as a property and finally the controller could decide whether to show e.g. an error message, or update the view etc. This seems nice, but in the `simple cases` where you are simply saving an item and it's clear the save succeeded or failed, it can also seem to be overkill. Creating and passing extra objects where maybe you just need an ID and a Boolean seems to make this pattern redundant. The thing is that this object needs to transfer from the controller, through the services, down to the repository, and back. The request part could be possible to ignore and only worry about returning a meaningful result too. It's hard to estimate whether it could be 50-50 or 40-60 where this type of system could be useful, but there are many cases that could use it, as well as many that aren't very useful. Is there better approaches to this issue, or have you found this pattern useful for the scenario portrayed? Is it worth the extra coding for the simple cases (in your case(s))?


Untyped lambda calculus: Why is call-by-value strict?

I'm currently reading Benjamin C. Pierce's “Types and Programming Languages”. Before really getting into type theory it explains lambda calculus and evaluation strategies. I am a bit confused by the explanation of _call by name_ vs _call by value_ in this context. The two strategies are explained in the following manner: ### _call by name_ Like _normal order_ in that it chooses the leftmost, outermost redex first, but more restrictive by not allowing reductions inside abstractions. An example:                 id (id (λz. id z))     → id (λz. id z)     → λz. id z      ### _call by value_ Only the outermost redexes are reduced and a redex is reduced only when its right-hand side has already been reduced to a value—a term that is finished computing and cannot be reduced any further. An example:                 id (id (λz. id z))     → id (λz. id z)     → λz. id z          (identical to the call by name evaluation)      Ok, so far so good. But this is followed by the following paragraph: > The call-by-value strategy is _strict_ , in the sense that the arguments to > functions are always evaluated, whether or not they are used by the body of > the function. In contrast, _non-strict_ (or _lazy_ ) strategies such as > call-by-name and call-by-need evaluate only the arguments that are actually > used. I know what call-by-value and call-by-name means practically, from having used (among others) C and Haskell, but I cannot see why the evaluation strategy explained above leads to this in the lambda calculus. Is this an additional rule that always accompany call-by-value, or does if follow from the reduction strategy outlined above? Especially since the reduction steps in the examples are identical, I fail to see the difference between the two strategies and would love if someone could help me gain some intuition.


How can I create a web form that displays and accepts Tamil language?

I am developing a PHP Application that needs to display and accept content written in tamil. For example "login" should be written in tamil on the form. How can I achieve this ?


Naming Convention for Dedicated Thread Locking objects

A relatively minor question, but I haven't been able to find official documentation or even blog opinion/discussions on it. Simply put: when I have a private object whose sole purpose is to serve for private `lock`, what do I name that object?               class MyClass     {         private object LockingObject = new object();              void DoSomething()         {             lock(LockingObject)             {                 //do something             }         }     }      What should we name `LockingObject` here? Also consider not just the name of the variable but how it looks in-code when locking. I've seen various examples, but seemingly no solid go-to advice:   1. Plenty of usages of `SyncRoot` (and variations such as `_syncRoot`).     * **Code Sample:** `lock(SyncRoot)`, `lock(_syncRoot)`     * This appears to be influenced by VB's equivalent `SyncLock` statement, the `SyncRoot` property that exists on some of the ICollection classes and part of some kind of SyncRoot design pattern (which arguably is a bad idea)     * Being in a C# context, not sure if I'd want to have a VBish naming. Even worse, in VB naming the variable the same as the keyword. Not sure if this would be a source of confusion or not.   2. `thisLock` and `lockThis` from the MSDN articles: C# lock Statement, VB SyncLock Statement     * **Code Sample:** `lock(thisLock)`, `lock(lockThis)`     * Not sure if these were named minimally purely for the example or not     * Kind of weird if we're using this within a `static` class/method.     * EDIT: The Wikipedia article on locks also uses this naming for its example   3. Several usages of `PadLock` (of varying casing)     * **Code Sample:** `lock(PadLock)`, `lock(padlock)`     * Not bad, but my only beef is it unsurprisingly invokes the image of a _physical_ "padlock" which I tend to not associate with the _abstract threading concept_.   4. Naming the lock based on what it's intending to lock     * **Code Sample:** `lock(messagesLock)`, `lock(DictionaryLock)`, `lock(commandQueueLock)`     * In the VB SyncRoot MSDN page example, it has a `simpleMessageList` example with a private `messagesLock` object     * I don't think it's a good idea to name the lock against the type you're locking around ("DictionaryLock") as that's an implementation detail that may change. I prefer naming around the concept/object you're locking ("messagesLock" or "commandQueueLock")     * Interestingly, I _very rarely_ see this naming convention for locking objects in code samples online or on StackOverflow.   5. (EDIT) The C# spec under section "8.12 The Lock Statement" has an example of this pattern and names it `synchronizationObject`     * **Code Sample:** `lock(SynchronizationObject)`, `lock(synchronizationObject)` **Question:** What's your opinion _generally_ about naming _private_ locking objects? Recently, I've started naming them `ThreadLock` (so kinda like option 3), but I'm finding myself questioning that name. I'm frequently using this locking pattern (in the code sample provided above) throughout my applications so I thought it might make sense to get a more professional opinion/discussion about a solid naming convention for them. Thanks!


git changing head not reflected on co-dev's branch

Basically, we undid history. I know this is bad, and I am already committed to avoiding this at all costs in the future, but what is done is done. Anyway, I issued a git push origin <1_week_old_sha>:master to undo some bad commits. I then deleted a buggered branch called release(which had also received some bad commits) from remote and then branched a new release off master. I pushed this to remote. So basically, remote master & release are clones and just how I want them. The issue is if I clone the repo anew(or work in my current repo) everything looks great....but when my co-devs delete their release branch and create a new one based off the new remote release I created, they still see all the old junk I tried to remove. I feel this has to do with some local .git files mistaking the new branch release for the old release. Any thoughts? Thanks.


Useful git commit messages for merged branches

_As a follow-up tothis question:_ If I'm working on a team by myself, I can maintain useful commit messages when merging branches by squashing all the commits to a single diff and then merging that diff. That way I can easily see what changes were introduced in the branch, and I have a single summary describing the feature/change/whatever that was accomplished in that branch when browsing the master branch. My question now is, how can I accomplish this when working with a team? In that situation, the branches will be pushed to a remote repository, meaning that I can't squash all the commits in the branch down to a single commit. If the branch is public, can I still have a single useful merge commit in the master branch? (By "useful" I mean that the commit in the master line tells me (1) a useful summary of what was done in the branch and (2) diffs of the same.)


Optimization of a hybrid pagination scheme

I'm working on a Web Application using node.js in which I'm building a partial copy of the database on the client-side to decrease the load on my server. Right now, I have a function like this (expressed as python-style pseudocode, but implemented in JavaScript):               get(table_name,primary_key):         if primary_key in cache[table_name]:             return cache[table_name][primary_key]         else:             x = get_data_from_server(table_name,primary_key) # socket.io             return cache[table_name][primary_key] = x      While this scheme works perfectly well for caching individual rows, I'd like to extend it to support the creation of paginated tables ordered according to the primary_key, and loading additional data using the above function for only the current and possibly the adjacent pages. Now, I don't want to keep the list of primary keys on the server to be retrieved every time I need to change the page (which, for reasons beyond the scope here, will be very frequent), and keeping it on the client side, subject to real-time create/delete events from the server, doesn't seem that good an idea, even after compression (using ranges, instead of individual values). What is the best way to calculate which items are to be displayed on a random page, minimizing the space requirements & the need for communication with the server?


Is Agile the new micromanagement?

This question has been cooking in my head for a while so I wanted to ask those who are following agile/scrum practices in their development environments. My company has finally ventured into incorporating agile practices and has started out with a team of 4 developers in an agile group on a trial basis. It has been 4 months with 3 iterations and they continue to do it without going fully agile for the rest of us. This is due to the fact that management's trust to meet business requirements with a quite a bit of ad hoc type request from high above. Recently, I talked to the developers who are part of this initiative; they tell me that it's not fun. They are not allowed to talk to other developers by their Scrum master and are not allowed to take any phone calls in the work area (which maybe fine to an extent). For example, if I want to talk to my friend for kicks who is in the agile team, I am not allowed without the approval of the Scrum master; who is sitting right next to the agile team. The idea of all this or the agile is to provide a complete vacuum for agile developers from any interruptions and to have them put in good 6+ productive hours. Well, guys, I am no agile guru but what I have read Yahoo agile rollout document and similar for other organizations, it gives me a feeling that agile is not cheap. It require resources and budget to instill agile into the teams and correct issue as they arrive to put them back on track. For starters, it requires training for developers and coaching for managers and etc, etc... The current Scrum master was a manager who took a couple days agile training class paid by the management is now leading this agile team. I have also heard in the meeting that agile manifesto doesn't dictate that agile is not set in stones and is customized differently for each company. Well, it all sounds good and reason. In conclusion, I always thought the agile was supposed to bring harmony in the development teams which results in happy developers. However, I am getting a very opposite feeling when talking to the developers in the agile team. They are unhappy that they cannot talk anything but work, sitting quietly all day just working, and they feel it's just another way for management to make them work more. Tell me please, if this is one of the examples of good practices used for the purpose of selfish advantage for more dollars? Or maybe, it's just us the developers like me and this agile team feels that they don't like to work in an environment where they only breathe work because they are at work. Thanks. Edit: It's a company in healthcare domain that has offices across US. It definitely feels like a cowboy style agile which makes me really not wanting to go for agile at all, esp at my current company. All of it has to do with the management being completely cheap. Cutting out expensive coffee for cheaper version, emphasis on savings and being productive while staying as lean as possible. My feeling is that someone in the management behind the door threw out this idea, that agile makes you produce more so we can show our bosses we're producing more with the same headcount. Or, maybe, it will allow us to reduce headcount if that's the case. EDITED: They are having their 5 min daily meeting. But not allowed to chat or talk with someone outside of their team. All focus is on work.


Converting our Windows Software to the web

We're looking at converting a software package from Windows over to the browser. It's a back office system consisting of Ledgers, Stock Control, Order Processing, etc and it's written in a legacy language (Dataflex). The project consists of 200+ database tables, 100+ reports, 300+ Views, 100+ Dialog boxes and 200 or so Selection Lists. I'm really struggling to get my head around the technologies that I'll need to use to convert this to a more modern web based programming language / framework. Even simple screens (Entering a stock location) seems overly complex. With the current language, I can drag a bunch of Fields to a form (a-la VB), wire in a tiny bit of database code and I've got a screen that'll allow me to find, delete, edit and change records easily. 10 minutes of development, tops. Has anyone got any suggestions on how I can move from my current VB style programming language to one that allows similar functionality on the web? Has anyone got any ideas how I go about working out how many man hours it's going to take to convert this sort of project to a new language on the web? What Web Framework options are available, and how do I decide between going with something like Rails vs going with something like ASP.Net? We've a tonne of code wired to OnClick and OnChange events. (I know this is bad). What strategies can I take with regard to converting this to the web? I'll admit - I'm hopelessly confused by some of the newer syntaxes used by modern languages. Is there any language that allows me access to the database without having to subclass everything through IEnumerable and various weird Typecasting things. Has anyone done anything like what we want to do? What were the pitfalls? Sorry about the vagueness of the question. I'd be more specific but don't know where to start. Delete away if I'm asking the wrong thing or in the wrong place.


Class Naming in Stock Trading Application

What do you normally call a class that stores open, high, low, close, volumne, and timestamp of a financial instrument(e.g. stock)? For example, in a 5 minute intraday chart, this object would hold OHLC, and volume between 10:00 and 10:05AM. Can anyone working in the field give me an advice?


Why are there non-decidable languages? Can anyone explain me my book's solution?

Well in my book it is says that "there are non-decidable languages" And the proof is: > Every algorithm is a word. Then there are only countable algorithms. But > there are uncountable languages and therefore more than algorithms Why is it said that every algorithm is a word? A word is a concatenation of symbols, elements of an alphabet, then what's the relation between a word and an algorithm? Can anyone explain me that?


Using only UI testing. Is that Ok?

I am a sole developer working with an offshore employer. I do realize the importance of unit testing (although haven't practiced before) but currently, the code hasn't ever been tested. The problem with the code is that it isn't what I call "been moduled well", some parts are really messy, extensive use of globals and the code doesn't really show loose coupling. If I am not wrong, the code might require heavy refactoring before being able to be unit tested. Also, it seems the employer, isn't quite interested in testing. He rather suggests to spend this time in building features. So what I suggested to him is UI testing. Because UI testing is something we do every time, testing features, clicking, checking if something is not broke, it made sense to both of us to use it to automate the process of checking features and save us time. Since I have never done UI testing before, I don't know what possible disadvantages might be associated with using just UI testing alone or will it be much beneficial at all?


Javascript Architectural Model

Are there any obvious flaws to this OO architectural model which I intend to implement using javascript? It is similar to the MVP model but instead the role of the model is broken down into three modules:   * the cache (stores data instead of rerequesting from server)   * the model (manages requests for raw data, retrieving it from the cache if available or the server)   * the modifier (handles requests which require data which makes changes to the data on the server) For a diagram showing how data flows through this model: ![enter image description here](http://i.stack.imgur.com/sUjYY.png) **view**   * sets up & manages the UI possibly requiring the requesting of data from the presenter   * sets up controls to alter what is displayed, possibly requiring the requesting of data from the presenter **cache**   * contains a record of some fetched data in data objects   * has a .store() method for storing data in the cache   * has a .retrieve() method for retrieving data from the cache   * access for storage and retrieval is available to the model and the modifier (acting as a faster intermediate location for the sharing of information than the server) **presenter**   * handles requests for formatted data from view   * requests data from Model (passing a callback for completion) formats data for presentation and calls view callbacks **model**   * handles requests for data from presenter   * requests data from cache (cache.retrieve())   * if data not in cache, requests it from server and then stores it in cache (cache.store())   * data passed back to presenter via callbacks **modifier**   * handles requests from view for modifications to data   * specify post, put and delete request types   * only support specific types of request which may be handled separately (eg settings)   * stores new data in cache (cache.store())   * pushes data to the server   * calls callback about the success of data storage This is quite big project and there will be a number of others working on it so it would be good to get it right from the off. **edit 1** The cache.store() and cache.retrieve() methods both only receive the information required to refer to the data in the cache, but do not specify how it is stored. The cache methods use this information to respond with or store the correct data, but the internal structure in which the data is stored is kept secret.


How do I make multiple calls to a web service without taxing that service heavily? Scaling question

is there a good pattern for how to send multiple calls to a web service but without taxing it and ensuring the data is sent back? I don't know enough to correctly describe the problem to even start googling it properly - current google results compare streaming vs. non-streaming wcf answers? Scenario: I am working on an app (I'm a jr. dev.) that needs to gather information from several sources about a 'customer' and the domains they own Technical: for one of the sources, I need to send a string array of domains to a web service and this web service returns an entry for each domain name, but this list of domain names will be thousands long - I would like to attempt to divide this list into bite-size chunks (1k domain names each) and then... queue them up to send to that web service, but ensure the web service doesn't skip one PseudoRequirements: Consumer of web page does not care how long it takes, but would like a list of results up front that does not require pagination to navigate. Current Theory: Should I take my massive 30k list, break it into 1k chunks, stuff each 1k-sized chunk into a 'request' object, assemble those 'request chunks' into a 'request chunk list' and iterate over that list (sequentially / blocking, so I don't strangle the WS) and for each 'request chunk' get back a 'response chunk' assemble those into a list, and then pass that list back into the front end for viewing? is this a viable method? is there a better way to queue items? Does anyone know off-hand any useful articles for this sort of queuing? are there any 'gotchas' or additional items to consider before I attempt my first pass? Additional Edits: -I do not have full control to the receiving service, I can not view it's code and the developers that manage it are... less than responsive to email. I do not currently know the stress testing limits of the web service. I emailed the owners of that component but have yet to receive a response - I was going to work up my design while I waited on them.


How to capture "Display advertisement" use case?

What kind of use case it would be for to "show ad in part of the view"? Who could be the actor to relate with? User or System? As user has no specific goal to see ads, i am wondering what is the best way to capture this in use case diagram? Any assistance will be helpful


Binary data storage scheme (saving user-uploaded files)

In our app we are currently saving binary data to the database (terrible, I know; but this is legacy stuff and it wasn't my decision). We're trying to migrate this data out to an external device and I'm trying to come up with a scheme to save these files. We have multiple tenants, I'd like to have a directory per tenant. My scheme for that is to build path using the first-three letters of the tenant. So if you had a tenant called `apple`, its files would be at `/a/p/p/apple`. Within these directories, I will save the files. For the files, I want to generate a random 6-character alphanumeric name (only lowercase characters for the time being because internal reasons). So if we generate a file name called `6a8jxo`, it will stored as `<tenant>/6/a/6/6a8jxo`. With this strategy, each tenant can have a maximum of approximately 916 billion unique files (not that we're attempting to save that many), with a maximum of 46,656 files per directory. If I go for a 5-character name, we will have a maximum of 60.5 billion unique files with 1,296 files per directory. Are there any drawbacks to this approach? I realize that certain directories may only contain one or two files, but in my mind that is not a huge problem. My colleague doesn't want to do it this way; he wants to use an autoincremented field in the database and then base the directory structure on the hex-value (I assume 32-bit) of that instead of using the tenant. With his strategy the hex value would be used as follows: the file will be stored in the directory located at `<tenant>/aa/bbb` where `aa` is the first two characters (most significant nibbles) of the hex value, and `bbb` is the next three. His reasoning is that he only wants to create new directories when one fills up instead of having numerous, partially-filled directories. This approach introduces numerous difficulties on the code side of things and I don't see having completely-filled directories as an argument that justifies the extra effort required to do this. Are there any other strategies or approaches I haven't considered?


Is there a Django reference?

I am new to Django. I have found the official topic guides https://docs.djangoproject.com/en/1.3/ an excellent place to learn from. But now I am in a place where I need quick reference to see what methods an object has, what arguments it takes, what it returns etc, kind of like the Python docs or Java docs. More of a reference than a tutorial. The official docs are tutorial style and do not necessarily have reference to all the methods. Am I missing something here? Do the Django official docs suffice for everyone?


Why are all desktop environments but KDE using GTK?

I recently did some hacking with Qt, and found it quite pleasant. Then I switched distributions on my laptop a couple of time, and noted that only KDE is using Qt, all the others are using the Gnu Image Manipulation Program Tool Kit. GTK is primarily a widget toolkit, although Windows and Mac ports do seem to exist. Not sure why one would build a DE on top of a toolkit for an image editor. Qt more of a cross-platform framework including threading, networking, and other non-GUI features. I heard licensing is considered a problem. Did I just answer my own question, or are there other things besides getting all zealotty about freedom? **update** I'd like to clarify that I'm not after opinions, but _observations_. "Qt is not real C++" is an observation, as is "GTK has been general purpose for a very long time". Besides, > But software and programming isn’t always a hard science, either. Once you > get past the does this code compile or not questions, you’re dealing with > issues of best practices, experiences, and behaviors. Perhaps because our > communities have become so accustomed to getting quick, accurate, and timely > answers, they feel that even a subjective Stack Overflow is better than the > alternatives. So much so, that our fellow programmers created a sister site > specifically for their pent up subjective questions. Take one heaping pile > of subjective questions, bottle it up for over two years and… kablooey!


How to dissuade a customer who just learned a technology and wants to use it everywhere?

My customer recently discovered what is URL Rewriting, without completely understanding what it is, how it works and the pros and cons of it. Now, he asks for lots of strange changes in actual requirements of current projects and changes in old projects in order to implement what he believes is URL Rewriting. **On one hand, I'm annoyed being asked to do things which doesn't make any sense** instead of doing real work. **On the other hand, I can't tell my customer that he doesn't understand anything in the subject** despite his interest in it. I think many people have had situations when their manager or their customer just learned a new buzzword or a new technology, and he loved it so much than he wanted to use it in every project, everywhere, rewrite the whole codebase just to use this new thing, etc. Also, I've recently read something related on Programmers.SE where people told about their experiences when there was a huge buzz around XML, and some managers would ask to introduce XML in every project just to show to everyone that they have used it. So those who have been in similar situation, how have you managed it?


Is there any circumstance in which a strict waterfall project can succeed when requirements are not clearly defined?

I can not see how a software project can make any meaningful progress under a waterfall methodology if the requirements cannot be clearly stated from the outset. Am I missing anything?


How often to release in Scrum sprint

How often to you release during a sprint. Only at the end of the sprint or every time a feature is ready. And how to you handle bugfix releases?


Parameterize Agent Based Simulation (OOP-Question)

I'd like to hear my fellow programmer's thoughts on the issue of parametrizing agent based simulations: Consider:   * Simulation core, including geometry, collision tests, some rules   * Different agents (modelled in OOP-fashion: has-a, is-a, abstract interfaces)   * Agents have different sensors, different actors, different controllers, ... All connected together by references/pointers and accessed using abstract interfaces. So essentially, each agent is composed of an ownership tree (agent owns sensors, controller, actors), superimposed by a dataflow-graph (sensor connected to controller, connected to actor). The tree, the graph plus the parametrization of the things together form a **simulation setup**. Running a simulation amounts to:   * Read in simulation setup   * Instantiate a bunch of objects, parametrize and connect them together to form the tree and the graph   * Run simulation   * Output some data (statistics, signals, whatever) The question is how best to save the simulation setup, and how to instantiate & parametrize stuff. Requirements (some of them conflicting):   1. The parametrization should probably be structured along the ownership tree, as it feels most natural.   2. A lot of times I'd like to instantiate a bunch of similar agents with just the 1 or 2 parameters changed between instances. That needs to be easy.   3. I'd like to keep parametrization and code close together. When experimenting with algorithms that are affected by parametrization, I wouldn't want the changes to be spread out over too many places.   4. Conversely, I'd like to keep parametrization out of the code, so that it's easy to automate simulation runs in order to systematically sweep through parameter spaces.   5. Parameters have meta-data: type, value range, physical unit, textual description, logical dependencies (e.g. if you specify X you must not specify Y)   6. Parameters not only affect data (member variables) but also code (usage of a particular specialization of the abstract base) * * * Now my colleges and me are tasked with building a new agent-based simulation:   * Do you know any frameworks / libraries / techniques?   * Are any patterns applicable? Best practises?   * Meta-programming?    * Abandon OOP altogether? Looking forward to your thoughts.


Is it safe to download VS11/.NET4.5 beta and still deploy to servers with .NET 4.0?

I've been wanting to try out VS2011 and .NET 4.5 beta, but the upgrade path is confusing at best. If I understand what I've read, the .NET 4.5 framework overwrites the .NET 4.0 libraries on your local machine, so libraries such as mscorlib.dll and System.dll will be replaced with the 4.5 version - fully backward compatible, but still different. If I'm developing ASP.NET sites with VS2011, and assuming I don't use any of the new 4.5 features in the code, do you know of any issues I might have by deploying to a web server with only the .NET 4.0 framework? I wouldn't expect any problems since it's the same CLR, but I'd like to know for sure before I do it. There's always the option of keeping a separate virtual dev machine for 2011/4.5 so that I can develop on 4.5, but go back to my original 4.0 machine to compile and publish, but I'd rather not go that route if I don't have to. Thanks


Should I include not-yet released projects on my resume/CV?

I finished a website project with new technologies such as HTML5 and CSS3. But my company will not let it go to production. They plan to launch the new site in their new project version function. Should I include such a non-yet-online project on my resume/CV?. Maybe with an additional explanation such as "this project is not released"?


Why is the main memory for object allocation called the 'heap'?

Has anybody got an idea why the area of main memory where objects are allocated is referred to as the heap. I can understand the rationale for that of the stack LIFO but would like to know what the rationale is for the 'heap' name.


Should my login logic be part of the controller or a service in MVC webapp

I'm using Shiro as my security manager for a Spring MVC web application. The login basically happens in these lines:               Subject user = SecurityUtils.getSubject();     user.login(new UsernamePasswordToken(username, password));      Where should I put this logic? `login()` can throw exceptions if the requested user doesn't exist or wrong password was provided, etc. Should I call the code from my controller and do the error handling there or should I call it from my service layer, catch exceptions and rethrow my own up to the controller?


Is there a graph with FOSS licenses detailing what can be linked with what?

I'm looking for a chart like this: ![alt text](http://i.stack.imgur.com/MmRTg.jpg) Basically something that tells you whether an app with a given license can be linked with a library of a given license. Does such a thing exist?


Dealing with a fundamental design flaw when you're new to the project

I've just started working on an open source project with around 30 developers in it. I'm working on fixing some of the bugs as a way to get into the "loop" and become a regular committer to the project. The problem is I think I've uncovered a fundamental design flaw that's causing one of the bugs I'm working on. But I feel like if I blast this on the mailing list I'm going to come off as arrogant, and some of the discussions I've had about the issue are butting heads with some of the people. How should I go about this?


Easiest language for simple Windows applications for novice Windows programmer?

Expertise: 11 years PHP programming I'd like to get into simple Windows programming for a kiosk project. What language should I choose? **My criteria:**   * easy to learn, "higher"-level language (e.g. not C++, I don't have a year to learn this)   * quick to get up-and-running (that's what I loved about PHP)   * well-documented & lots of community resources   * easy GUI creation   * client wants windows machines so Linux is not an option **What I've gathered from other Stackexchange answers and Google, but have no experience using:**   1. QT + Python (wish PHP-Qt was more mature -- it doesn't seem to have much of a community)   2. C# (seems like overkill for a simple kiosk)   3. Firefox + kiosk extension + AMP for GUI, and macro software to manipulate windows, files, lower-level stuff.


SQL Query syntax - formatting?

I'm looking at a very large (5-6 digit LOC), very complex, code-base, full of interacting bulky, interdependent, views and stored procedures (multiple 4-5 digit count silos). The source SQL has been touched many times, by many different people, and no formatting constraints have been enforced. This led to wildly differing formatting for SQL, even within single stored procedure/view definitions. The code continues to be worked on by several groups of, mostly, senior programmers, and sees a steady stream of small changes and improvements. * * * Under these conditions: a. what is a sane standard to conform to for formatting (eg, should we use all caps for keywords? seems like the small benefits from having so many programmers not have to press Shift actually add up to significant time/cost savings) b. is it worthwhile advocating for a major refactor to standardize the formatting (ie, is the cost of training a large body of programmers/changing their behaviour/ill will at enforcing a new constraint worth the benefit in the long-term?)


Source code for TCP/IP stack

Am looking for an open source code for the TCP/IP stack. An explanation along the lines of the stack would also help me in understanding the different modules and their interactions. I tried searching but there is very less information relating to just the TCP/IP stack.


Naming objects and properties clearly without exposing implementation details

I'm re-architecting an iOS mobile app that consumes an API with somewhat haphazard and oftentimes slow performance. The reason for the slowness is because the API is actually a layer on top of a variety of other platform- level services, some of which run slowly. You then get into the weakest link type of situation where the time it takes for the API to respond is bound by the slowest lower-level service response. When consuming the API I'm getting dealing with an object, let's call it `Foo`, that I display in a table, and also on a detail screen as necessary. A trade-off made by the API designer/implementer was to provide a call to get a list of `Foo` with some specific properties omitted (getting these properties for more than 1 or 2 objects at a time is very slow) and a "detailed view" call to provide a single object with all the properties filled in. The initial model schema had two model objects `Foo` and `FooDetails`. Feeling that this exposes unnecessary implementation details, I've merged both `Foo` and `FooDetails` into `Foo`, but a way to easily represent whether `Foo` is complete or not is still needed. (Meaning does `Foo` have extra properties present or not.) The best I could come up with was an enum:               typedef enum : NSUInteger {              ELYFooAbridgedState,         ELYFooCompletedState          } ELYFooCompletenessState;      I did not want to go with a `BOOL` due to the possibility of multiple "in between" states in the future as some lower level services are tuned. Can anyone provide an alternative naming or representation for this situation? Are there drawbacks w.r.t. to future proofing when taking this approach? This may the only time it's possible to do a ground up refactor of the app's model schema entirely, and I'd like it to be as resilient as possible.


When you use inheritance to reuse code, do you find it too tricky that it swallows the benifits of reuse?

I've been coding for about 8 years, however I still find inheritance is too flexible and sometimes it makes you totally confused with the code you have written. One simplest example would be:               abstract class AClass {         protected void method1() {             if(check()) {                 do1();             } else {                 do2();             }         }         protected abstract void do1();         protected abstract void do2();     }      The intention of the class is that people can implement do1() and do2() so that some further logic can be done, however sometimes people decide to overload method1(), and then things become complicated immediately. I find only in strategy pattern, code is reused well through inheritance, in most case the designer of the base class know its subclasses very well, and that inheritance is totally optional. I have a class that's inherited by 4 classes - an IoHandler, and it's subclasses for server side, client side, edge server, origin server, and it begins to drive me crazy. I was always in code refactoring, I always came out with ideas I think would work and then were proven not. It's said that human brain can only hold 7 pieces of information one time, am I carrying too many?


Writing documentation for well understood methods like equals in Java

Is it a good practice to write comments for widely known methods like equals, compareTo etc? Consider the below code.                /**      * This method compares the equality of the current object        with the object of same type      */     @Override     public boolean equals(Object obj) {                         //code for equals               }         My company madates to enter comments like the above.Is the above Javadoc comment required? Is it not obvious and well understood what the equals method and the likes (compare,compareTo) etc does? What are your suggestions?


How to make ASP .NET MVC website have a continuous process running?

This website is supposed to be a game where the players have some 'buildings' and these buildings produce resources. E.g. an iron mine may produce 30 pieces of iron ore per minute and automatically add it to the user's inventory. It doesn't matter whether the user is online or not, it should be running 24/7. So when the user does log in to their account, they will see their stack of iron ore has built up depending on how long it has been. Some pointers in the right direction would be greatly appreciated :)


What factors should I be looking at to increase performance in image resizing?

I'm setting up a web app in which people will upload images. Once uploaded the images will be watermarked then resized multiple times (Thumbnails, different sizes etc.) and finally uploaded to Amazon S3 for storage. The web app is written in Python with the Tornado framework, I don't really want to lock up the Tornado threads with the image processing so I'm going to send it out to a seperate script (and possibly even seperate servers) using Gearman (I've developed an async-gearman client for Python/Tornado). One of the advantages of Gearman is that it's possible to launch jobs in multiple languages, so the actual processing and uploading of the image could be done in ether Python, Ruby, PHP, Perl, Java, C, or something else. This leaves the question, is one better for the job? Are there certain libraries only available for specific languages that are especially good at image resizing? The most important thing will be performance: we'd like to be able to run as many jobs on a server as possible. Are there other factors I should be looking at? I'd prefer to stick with Python, Ruby, or PHP because that's what I'm familiar with but if the performance gain from doing it in Java/C is good enough I'd be okay with implementing it like that. I'm **not** looking for code examples, I can find those myself, but I'd like to know if there are any big differences between the image processing libraries. I know PHP probably has the easiest to use wit GD, and I've used a couple of the Python libraries before and they seem okay. I've never done anything with images in Ruby.


Dependency inversion always includes dependency injection?

This is a question on a home work. I've been up and down my notes and I can't even see how the two are related. Googling this gives me questions/answers on one or the other, but never both.


MVVM and service pattern

I'm building a WPF application using the MVVM pattern. Right now, my viewmodels calls the service layer to retrieve models (how is not relevant to the viewmodel) and convert them to viewmodels. I'm using constructor injection to pass the service required to the viewmodel. It's easily testable and works well for viewmodels with few dependencies, but as soon as I try to create viewModels for complex models, I have a constructor with a LOT of services injected in it (one to retrieve each dependencies and a list of all available values to bind to an itemsSource for example). I'm wondering how to handle multiple services like that and still have a viewmodel that I can unit test easily. I'm thinking of a few solutions:   1. Creating a services singleton (IServices) containing all the available services as interfaces. Example: Services.Current.XXXService.Retrieve(), Services.Current.YYYService.Retrieve(). That way, I don't have a huge constructor with a ton of services parameters in them.   2. Creating a facade for the services used by the viewModel and passing this object in the ctor of my viewmodel. But then, I'll have to create a facade for each of my complexe viewmodels, and it might be a bit much... What do you think is the "right" way to implement this kind of architecture ?


How to create single integer index value based on two integers where first is unlimited?

I have table data containing an integer value X ranging from 1.... unknown, and an integer value Y ranging from 1..9   The data need to be presented in order 'X then Y'. For one visual component I can set multiple index names: X;Y   But for another component I need a _one-dimensional integer_ value as index (sort order). If X were limited to an upper bound of say 100, the one-dimensional value could simply be X*100 + Y.   If the one-dimensional value could have been a real, it could be X + Y/10. But if I want to keep X unlimited, is there a way to calculate a single integer 'indexing' value from X and Y? [Added] **Background information** : I have a Gantt/TreeList component where the tasks are ordered on a TaskIndex integer. This does not need to be a real database field, I can make it a calculated field in the underlying client dataset. My table data is e.g. as follows:               ID    Baseline   ParentID      1       0          0     (task)      5       2          1     (baseline)      8       1          1     (baseline)      9       0          0     (task)     12       0          0     (task)     16       1         12     (baseline)       Task 1 has two baselines numbered 1 and 2 (IDs 8 and 5)   Task 9 has no baselines   Task 12 has one baseline numbered 1 (ID 16) Baselines number 1-9 (the Y variable from my question); 0 or null identify the tasks   ID's are unlimited (the X variable) The user plays with visibility of baselines, e.g. he wants to see all tasks and all baselines labeled 1. This is done by updating a filter on the table. Right now I constantly have to recalculate TaskIndex after changing the filter (looping through records with a counter). It would be nice if TaskIndex could be calculated on the fly for each record knowing only the _ID_ and _Baseline_ data in the current record (I work in Delphi where a client dataset has an OnCalcFields event handler, that is triggered for each record when necessary). I have no control over the inner workings of the visual component.


Entry level engineer question regarding memory management

It has been a few months since I started my position as an entry level software developer. Now that I am past some learning curves (e.g. the language, jargon, syntax of VB and C#) I'm starting to focus on more esoteric topics, as to write better software. A simple question I presented to a fellow coworker was responded with "I'm focusing on the wrong things." While I respect this coworker I do disagree that this is a "wrong thing" to focus upon. Here was the code (in VB) and followed by the question. Note: The Function GenerateAlert() returns an integer.               Dim alertID as Integer = GenerateAlert()     _errorDictionary.Add(argErrorID, NewErrorInfo(Now(), alertID))          vs...                _errorDictionary.Add(argErrorID, New ErrorInfo(Now(), GenerateAlert()))      I originally wrote the latter and rewrote it with the "Dim alertID" so that someone else might find it easier to read. But here was my concern and question: Should one write this with the Dim AlertID, it would in fact take up more memory; finite but more, and should this method be called many times could it lead to an issue? How will .NET handle this object AlertID. Outside of .NET should one manually dispose of the object after use (near the end of the sub). I want to ensure I become a knowledgeable programmer that does not just rely upon garbage collection. Am I over thinking this? Am I focusing on the wrong things?


Would it be hard to screen form submissions (e.g., comments) for non-words/non-sentences?

I've been thinking a lot lately about the need for better form security, and good ways to accomplish that. We currently use captcha codes to screen for bots, but that's annoying to users and may not work forever. I think that we need a more intuitive, organic system for screening bad comments/contact form submissions. One option that has come to mind would be trying to screen comments for things that are obviously not words, in addition to screening for duplicate comments. E.g., when a spammer on Facebook, Twitter, or a comments section is stopped from just posting the same thing a lot of times, they add garbled letters and or numbers somewhere in the post to make it "unique". If it was possible to screen out obvious not-text, this could be overcome. If you could go a step further, and screen out posts that obviously have words placed in for no reason except to make the post "unique", you could force the spammer/scam artist down to only use repetitive post options which actually make gramatical sense. At the very least, you could have posts be flagged for moderator attention if they looked similar but which just had random garbage added in for no reason. This would significantly reduce a spammer's ability to keep spamming, even across multiple accounts. Could it be possible to screen form field results for random word and number combinations, and words thrown in just to make a post "unique"?


Visitor stability vs instanceof flexibility

I am working on a GUI application which generates a configuration file. I have a class hierarchy for the configuration model and I use an object tree of that hierarchy in several different contexts. Currently, I use the Visitor pattern to avoid polluting my model classes with context specific code.               interface IConfigurationElement {         void acceptVisitor(IConfigurationElementVisitor visitor);     }      In an earlier version I used chains of `instanceof` conditions instead of the Visitor. Comparing the two approaches I see the following tradeofs. _Visitor_   * It is easier and safer to add new `IConfigurationElement`. Just add a new declaration to `IConfigurationElementVisitor` and the compiler generates errors for all visitor implementations. With `instanceof` chains you have to remember all the places you have to extend with the new configuration element. Basically `instanceof` violates the DRY principle as it duplicates logic in several places.   * The visitor pattern is more efficient than a chain of `instanceof`conditions _instanceof_   * The great advantage of `instanceof` is its flexibility. For example `instanceof` allows me to define special solutions for different subsets of `IConfigurationElement` implementations which need to be handled similarilly in some cases. In contrast, Visitor forces me to implement a method for each implementation class every time. Is there a common solution for this kind of problem? Can I adapt the Visitor somehow, so I can provide a common solution for some cases?


Fernando J. Corbató's “Constrained languages”

For his 1990 Turing award speech, Fernando J. Corbató listed reasons why complex systems will inevitably fail. In his conclusion, he gives some suggestions for decreasing the probability of failure. He lists one idea as follows: > [U]se of constrained languages for design or synthesis is a powerful > methodology. By not allowing a programmer or designer to express irrelevant > ideas, the domain of possible errors becomes far more limited. What does he mean by "constrained language?" For a moment I considered constraint programming. However, constraint programming is about restricting the program's solution space. It is a tool that empowers a programmer. The feature Corbató is referring to seems to be something which actually restricts the programmer, or at least makes her more inclined to write terser code. My second thought is that he is referring to conservative programming languages. Corbató received his Turing award for work done in the 1960s and 1970s. It's my understanding that he dealt with a lot of punch cards. I have never seen a punch card, so I certainly don't know how to program one, but I might guess that punch card programming is extremely liberal. I suspect the notions of type checking, static analysis, and so forth simply didn't exist. So, is Corbató perhaps referring to the idea of languages that restrict the developer from making dumb mistakes? This doesn't seem to be the case, either. Safety checking and data modeling have nothing to do with terseness, which is what he seems to be talking about when he mentiones "not allowing ... irrelevant ideas."


Descriptive Locking and Concurrency

I'm thinking about how one would go about designing a descriptive concurrency model for an OOP language that helps simplify concurrency scenarios for programmers (no easy task, concurrency is hard). I've read a bunch about software transactional memory, the actor model, immutability etc etc but they don't exactly seem to offer an easy model either, and while functional programming is great for some concurrency and parallel scenarios some times you simply need to mutate some kind of state. While locking is considered bad by some atleast it's fairly easy to reason about on a basic level (until you get into deadlock territory that is) Anyways, one of the ways I thought programmers could somewhat easier handle multi-threaded scenarios was that each class is responsible for it's own thread-safety on a per method/property basis. Ie other classes can only access properties and methods, they can't really lock on anything specifically, nor should they have to. One way to make it easier though would be to annotate methods and properties for concurrency with their indent rather than locking specifics. The compiler will then try to deduce the most performing lock from that. So assuming atomicity what do you think good annotations would be? and what are potential problems with this approach, I'm aware that it can't solve all scenarios (like transactions) but it should help the compiler enforce the programmers intent, and might even be able to warn on potential deadlock/racing scenarios Here's some of the attributes i thought of so far (also note that none of them are mandatory but strictly compiler "hints")               <property preference="none|read|write|fair">             <get access="free|exclusive|shared"             load="unknown|many|few"             duration="unknown|nano|brief|long"/>              <set access="free|exclusive|shared|upgradeable"             load="unknown|many|few"             duration="unknown|nano|brief|long" />          </property>      So for instance if get and set was set to shared access you might end up with an reader-writer lock. (do I need an attribute to control visiblity.) If duration for a write was set to nano perhaps it would use a spinlock. If there are many reads and few writes perhaps the compiler would use a different lock that if there were many writes and few reads etc etc. Methods can be coupled into read/write pairs similarly to properties (in case you need more than one parameter). For numeric properties that typically update based on some condition of it's value I was also thinking that instead of passing just a new value, you could pass an operator and an amount. That way you could lock, calculate the new value, see if it meets some internal condition and in that case update. Anyways, I'm struggling a bit coming up with good attributes/notations that are somewhat easy for a programmer to wrap their head and reason about, any help and feedback deeply appreciated. Sorry for the long rant, as I said this isn't an easy topic :)


Formal term to web-ify a piece of existing software or program or a module?

There is a software we run as a windows service. Its currently not designed to take a huge load. So we kind of need this service to be hosted over http so that multiple clients can make use of it. Its not the whole windows service as such, but some modules it uses. Those modules are currenly not designed to work as "web service" (generic sense). What would be the formal word for this?


category theory based language

It may sound naive, but is there any programming language, or research thereof, based entirely on category theory? I mean this as opposed to embedding CT concepts as an additional feature (like for Haskell or scala). Would it be too abstract or too complex as an approach, or are there any known reasons that makes it impossible or impractical? I have only a relative understanding of the theory as related to programming, so please give me some explanation if the question doesn't makes sense at all EDIT What I mean is to define a language where categories are first class concepts, instead of let's say types. E.g. haskell is defined in terms of _types_ and _functions_ over those. Does it makes sense to design a language where fundamental entities are _categories_ and _arrows_? From there you would, for example, define algebraic operations on numbers as individual "intances" of the proper algebraic category (ring, monoid, group...) instead of starting from standard integer/float operations and defining the corresponding categorical typeclass. Does it makes sense?


Want some architecture input to help with current requirements and future (unknown) requirements :-)

**BACKGROUND:** I am starting to architect a web project using asp.net mvc. I'm going to use a very common architecture where I have the following layers:   1. Service    2. Biz   3. Data   4. Domain The Service layer interacts with the Biz, Data and Domain layers. The mvc controllers will have the service layer injected into them using a DI framework. The controllers will need to be aware of the Service layer interfaces and will reference the Domain objects (POCOs). The front end will be HTML5 + Javascript. I have been told to keep in mind we need to expose _portions_ of this website to mobile devices. The _portions_ to expose via mobile devices is to be defined :-). When rendering the site I can simply have a mobile layout that renders to a mobile device. But one thing management told me is mobile users might want additional functionality the website doesn't expose. Maybe they want to access a feature that only a native mobile application can provide. Hey, I don't make up these requirements, this is what I was told :-). **THOUGHTS:** My service layer is the gateway to storing objects in my database. For any potential native mobile devices I was thinking about using the Web API to wrap my service layer. What I want to do NOW is focus on on my asp.net mvc application and only worry about native mobile apps when those requirements become more defined. **QUESTION:** would it provide any benefits to code the Web API layer now and have my mvc controllers use it? * * * Pros for creating the Web API now   1. It will be coded and ready if / when a native mobile app comes online. Cons for creating the Web API now   1. It is overhead that is not needed, especially if I host the WebAPI in a seperate process or another site besides my original asp.net mvc site.   2. The technology is fairly new and enhancemens will be forthcoming. If i wait until later some of the issues will be fixed.   3. Who knows, my users may never want a native mobile device and the feature is never utilized.   4. The code becomes more complex because of having to maintain the web api layer now. I'm looking at not worrying about the Web API layer for now and simply coding it when necessary. Typically I don't worry about writing for functionality that is yet to be defined. But I thought it might not hurt to ask, you never know what some brilliant maverick programmer is doing out in the wild :-).


Does the use of personas in Agile have any value during implementation?

This is about the use of personas, primarily in the agile development realm. What value, if any, do personas give during implementation?   On agile modeling, the discussion about personas remains in the context of requirements investigation.   On wikipedia, the benefits are described to "assist with brainstorming, use case specification, and features definition." I'm familiar with personas in use while writing user stories such as the following: > As Willow, I want ordering a combo meal to give me the option to select > alternate sides.   >  As Xander, I want the default side to be selected when I order a combo > meal. In these examples, Willow is the nutrition-conscientious user of meal-ordering software and Xander is the hungry, impatient user that thinks "fast food should be _fast_." When coming up with these requirements, it may have been helpful to have the personas in mind. I imagine a possible discussion: > Person 1: Willow needs to have more options than fries for the combo meal, > otherwise she would never order a combo.   >  Person 2: But Xander doesn't want to have to sift through different options > when ordering a combo! He just wants fries and he'll probably always want > fries. This discussion may have created the two requirements above, but once the requirements have been created, why do we mark each requirement with a persona? I wouldn't code the 'default side' requirement any differently knowing that it is for Xander. What value does retaining the "As Willow" and "As Xander" starts to the requirements once they have been written? What value does the persona give to the one who implements the requirement?


Is there any hard data on the (dis-)advantages of working from home?

Is there any hard data (studies, comparisons, not-just-gut-feel analysis) on the advantages and disadvantages of working from home? My devs asked about e.g. working from home one day per week, the boss doesn't like it for various reasons, some of which I agree with but I think they don't necessarily apply in this case. We have real offices (2..3 people each), distractions are still common. IMO it would be beneficial for focus, and with 1 day / week, there wouldn't be much loss at interaction and communication. In addition it would be a great perk, and saving the commute. * * * Related: Pros and Cons of working Remotely/from Home (interesting points, but no hard facts) * * * To clarify: it's not my decision to make, I agree that there are pro's and con's depending on circumstances, and we _are_ pushing for "just try it". I've asked this specific question because (a) facts are a good addition to thoughts in arguing with an engineer boss, and (b) we, as developers, should build upon facts like every respectable trade.


Extension objects pattern

In this MSDN Magazine article Peter Vogel describes Extension Objects partten. What is not clear is _whether extensions can be later implemented by client code residing in a separate assembly_.   And if so _how in this case can extension get acces to private members of the objet being extended_? I quite often need to set different access levels for different classes.   Sometimes I really need that descendants does not have access to the mebmer but separate class does. (good old friend classes) Now I solve this in C# by exposing callback properties in interface of the external class and setting them with private methods. This also alows to adjust access: read only or read|write depending on the desired interface.               class Parent     {         private int foo;              public void AcceptExternal(IFoo external)         {             external.GetFooCallback = () => this.foo;         }     }          interface IFoo     {         Func<int> GetFooCallback {get;set;}     }      Other way is to explicitly implement particular interface. But I suspect more aspproaches exist. **Update 1**   New Peter's article makes it a bit clearer.


Approach of delivering “Logging API”

I faced a question in a .NET interview. As a client i need a LoggingAPI. How you go the approach of design and development and delivering Logging API to the client? I don't care about WPF or a language specific. I want a LoggingAPI which has to log some data? what is your approach in delivering the same. I failed to answer for this question. Please guide how to proceed for answering this type of questions.


How can we track how well we're preventing and avoiding security vulnerabilities?

It's pretty easy to track when we fix security vulnerabilities in existing code. But to make sure the whole team is staying on their toes about writing secure code, I'd like to also track how well we are preventing and avoiding writing new security vulnerabilities. What is the right way to measure that?


Are there any arguments that can make a contractor reconsider working on fixed price?

I've been working for a contractor who brings in some good projects, but they are all fixed-price and often fixed-time. As a result he always has me making a quote over loose requirements, which never fails to bring a lot of tension due to feature creep. He claims he'd never get a contract if he couldn't agree on a price with his clients first, but as far as I'm concerned I don't wanna go through another project under these terms. Is there any argument I could make to have him pay me by the hour, or should I just suck less at estimating ?


Can applications affect power consumption in a substantial way?

Is there anything that can be done for a single general purpose application to affect the power consumption of the device it is running on? I am not familiar with how optimizations to individual applications may affect power consumption in a general way, can someone explain if different approaches to writing applications affect power consumption of the device they are running on? That is, can a single program, that does the exact same thing functionally, written in different ways drastically affect the power consumption of a device in general, not about how different un-related programs might affect the power consumption of a device.


RDBMS same type of optional data for multiple tables

I have an embedded database (SQLite), it stores information about events and page views, its purpose is to track the user journey inside my application. I need to provide support for optional custom properties on my events and page views. In code this is not a problem, however I am torn between two solutions for storing that information. So I have Events and PageViews tables, my first option for persisting the optional custom properties is to have a EventsCustomProperties table which has only a name and value column and a reference (foreign key) to the event. In this solution I would also have a PageViewCustomProperties with the same structure. The problem I have with this is having two tables which are identical other then their relationships with other tables. In my other solution I would have one CustomProperties table, and in addition to the name, value and relationship key, it would also have a type column, which I should use manually in code to map the relationship id to an event or a page view. In this solution the actual use of foreign keys is redundant. My dilemma is that in the first solution I am respecting one normalisation rule of repeating groups of data, buy in the second solution I am breaking another rule although I cannot get my head to remember the name of the rule. So it seems I will break rules whatever I do. Can anyone suggest a better way or a preference to the first or second solution.


Should I split a Python class with many methods into multiple classes?

I have a class that will end up having more than ~30 methods. They all make sense to be part of the same class because they require access to the same data. However, does it make any sense to split up a large class into several smaller abstract classes (by functionality, type, use, etc.) and have the main class extend (i.e. multiple inheritance) from all the smaller classes?


I've been considering moving to a new city (getting seduced by those big city lights), and I'm trying to decide if my lack of "computer science"-y skills is going to make me overly uncompetitive. Let me explain my situation a bit more:   * Programming since jr. high school, professionally since 2004. I've worked for a small company that does custom web applications (PHP) since 2006.    * I've studied design patterns on my own, and used them in my work.    * Worked with MVC frameworks (PHP) for a couple years now. I have a strong understanding of how to write good, maintainable MVC code that adheres to the principles of MVC (rather than just cramming code into wherever I can in the framework.)    * Recently done some work with C#, through which I'm learning dependency injection and the MVVM pattern. Grokking these, but still a ways to go.   * Full complement of web development skills (normalized databases, SQL, HTML, CSS, JavaScript), and I'm very confident of my skills in these. Also aware of security issues, and how to write a secure application. My main deficiency is scalability, which I've never had a need to learn, unfortunately. Where I get nervous is with the things you'd learn in a CS degree. My degree is in aerospace engineering, not CS, but I've decided that programming is the thing I really care about. What I know:   * Basic data structures: I took a class in which I implemented basic linked lists, and queues and stacks built on those. I've written a basic binary tree (inserts, various traversals, but not removal (I was really drunk when I wrote the code, and it turned out not to work at all)). I know about hash tables, and understand some of the principles of their implementation.   * I understand big-O notation, but since I'm not really familiar with algorithms, I suspect I might miss interview questions about this topic. (what's the worst-case insertion time into a hash table? I have no idea.)    * I've done a little bit of functional programming by way of JavaScript, python, and dabbling in Haskell. (I realize the first two aren't functional programming languages, but they have functional aspects to them). I understand currying and higher-order functions. What I don't know:   * Don't really know formal algorithms at all. I couldn't sort my way out of a paper bag (well _maybe_ bubble sort, which I know is O(n2)). I guess I know some of their names.   * Never written a parser, or compiler, or any component of an OS. I've never done anything interesting with concurrency (e.g., anything beyond using basic asynchronous calls in .NET to keep my UI from blocking.) I _want_ to learn all these things, purely out of interest, but for now I simply don't have time right now with main job + side job + life outside programming ( _gasp!_ I know). I don't want to put my larger life plans on hold unnecessarily if I don't have to. I'm not aiming for a Google or a Microsoft, but I'd like to at least get a job that's interesting. How much will I be held back by the deficiencies I've listed? I feel relatively confident that in a job I would actually apply for and get, I would be able to perform very well, but what about interviews? I'd like to know:   * How crucial are computer science topics toward getting a job?


How do I handle a Controller that's not controlling a specific Model?

I've got a nice MVC set up going but my website requires some views that don't map directly to a model. Specifically I've got some generic Reports users need to run, and now I'm creating a utility for comparing some system configurations. Right now the logic is crammed into a Reports Controller and I'm starting a Comparison Controller but this feels like a big abuse of the system. Both controllers use an assortment of different Models to pull data from, and they're only related based on _what the user is doing_. Reports are run from the Reports Controller and their views are all grouped together in the file system/URL structure. Is this an acceptable use of the Controller paradigm? I can't think of a better way to structure my Controllers, and making a Controller for each model I'm using to make reports/ect doesn't seem like a good idea; I'd end up with one Controller/Model/View per report or comparison, vastly complicating the apparent structure of my site.


What's the right OO way to create a counter/inventory class that works for both differentiated and undifferentiated countables?

You are writing a videogame about trading beans. Red beans, black beans, pinto beans, you name it. As everybody knows all beans are the same. You write the "Inventory" class for a trader in that videogame as follows (skipping all the null checks):                   class BeansInventory{     HashMap<BeanType,Integer> amountsOwned;          public void receive(BeanType typeReceived, int amount)     {amountsOwned.put(typeReceived,amountsOwned.get(typeReceived)+amount)}          public void remove(BeanType typeRemoved, int amount)     {amountsOwned.put(typeRemoved,amountsOwned.get(typeRemoved)-amount)}          public Integer amountOwned(BeanType type)     {amountsOwned.get(type)}     }      It works fine for years. Then suddenly somebody else has the great idea to add to the game trading coffee beans. As everybody knows each single coffee bean is completely different from the other. So you can't just add coffee as another bean type. Each coffee bean is its own instance. The coffee inventory class looks something like this:               class CoffeeInventory{         HashMap<CoffeType,List<CoffeeBeans>> coffeOwned;              public void receive(CoffeType typeReceived, CoffeeBeans... beans)         {coffeOwned.get(typeReceived).addAll(beans)}              public void remove(CoffeType typeRemoved, CoffeeBeans... beans)         {coffeOwned.get(typeRemoved).removeAll(beans)}              public Integer amountOwned(CoffeType type)         {amountsOwned.get(type).size()}         }      But now you have tons of problems. You have two APIs for the same task. All the trading infrastructure now has to check carefully if it is trading pinto beans or coffee beans and call a different inventory and a different method with a different signature for what is after all the same task: "store this". So now I have this code that is getting filled of `if` checks and `instanceof` and all the other signs of code smell. But I can't figure out a way to use a single simple API. I have no idea what's the right oo thing to do.


Is dynamic HTML layout good from an SEO perspective?

Just wondering whether dynamically built HTML layout is fine from SEO perspectives? So let's assume e-commerce engine and its most popular page - products catalog. So 90% of the page is built using AJAX and MVVM library knockoutjs which builds HTML on the fly on the client side. So how search bots would parse such content? Is it fine indexed and would be such effective as server-side built HTML pages from the SEO perspectives?


how to do database updates in each release

Our application uses database (mostly Oracle), and database is at the core. Each customer has its own database, with its own copy of application. Now with each new release of our product, we also need to update the database schema. These changes are adding new tables, removing columns, manipulating data etc. How do the people handle this? Are there any standard processes for this? EDIT:- The main issue is the databases are huge with many tables and more of huge amount of data. We provide the scripts and some utilities to manipulate the data. How to handle the failures and false negatives? More of looking for this kind articles. http://thedailywtf.com/Articles/Database-Changes-Done- Right.aspx


Is there any value in Open sourcing your for fun projects

I have written a bunch of fun for me projects and have shown them to friends and such. Is there any value in doing the work and making these projects open source since the interest and usefulness limited.


Copying a competitor's database schema?

I am going to be releasing some software soon which will require users to run a local database. There is a competitor in the space that is doing the same thing and they have a pretty sophisticated database schema that they use. Their software is commercial but the database schema is completely viewable once installed. What's the legality of basing my product of the same database schema and just potentially renaming columns and tables and maybe removing one or two things?


Is it reasonable to use Javascript MVC Frameworks for closed source paid web applications?

I am wondering if it is reasonable to write closed source, paid web apps in Javascript (JS MVC Frameworks like AngularJS, Backbone, Knockout, ...)? I'm concerned because in this type of frameworks you use typically a REST backend for CRUD operations and the majority of business and application logic happens in Javascript which can be looked up by anyone using my app. He can see how i do things. When I use for example PHP or Java (Wicket) most of the logic is happening on the server and so a lot less of my source code is exposed. This seems to me a lot safer if I want to have an edge over my competitors, so potentially I earn more money. So is it reasonable to use JavaScript MVC Frameworks for paid applications? Does it depend on something and if yes on what?


are programmers more forgiving of buggy software?

From your experience are you, or programmers in general, more or less likely to forgive bugs in the software you use? e.g. if you run across a bug in some app (commercial or open source), is your reaction annoyance at incompetence, empathy, or something else (pity)?


Is it bad to be the only person supporting software you have developed?

My employer has a need for a web-based application to manage and share data within the department, with approximately 50-75 possible users. I feel I have the ability to write it for them. I would likely use Python/Django with a MySQL database, so it would be open source. However, I'm the only IT person in my department (our larger organization has a separate IT support staff with which I often work, but not for web development). I want to develop this application, but if I leave in 1-2 years, and someone else has to come in after me and support it, will this be seen as a bad decision? This is assuming all the obvious points -- I will write documentation, I will comment my code, and I will strive to follow good application design principles. But will that be enough? In principle, is it acceptable for one person to develop and support an entire web application? Is this a "do first, then show and ask" kind of situation, or should I be certain it will be adopted by everyone involved first? With regards to specifics, I work in an academic department of a university that has specific processes for student applicants and for their being admitted. You have to apply to the university, AND my department separately. The department-specific process is very manual and pieced together, which is where my development would come in. We (myself and IT) are already planning on incorporating the additional questions that pertain to my department into the main university application (which IS electronic, and feeds into PeopleSoft), so that solves the front-end piece and everything would be in one place. But for the faculty and staff to acquire and "digest" that information throughout the admissions process will require an application of some sort, which I would prefer to do "my way". The IT staff want to develop it ALL in PeopleSoft, and I fear it will be too inflexible and will not be well received by our department, and may still not completely meet our needs. There are third-party solutions which meet this need perfectly but they are cost-prohibitive. I would query the data from PeopleSoft and present it how I know the faculty and staff need to see it. (Getting access to query PeopleSoft is a different battle altogether.)


DB API for shell scripting (any shell)

I am faced with some legacy shell scripts that run batch data processing jobs in Oracle using `SQL+`. For the most part, the data tier does not have to communicate back to the script with retrieved data to be passed for shell- level processing but in a few cases it does. The problem is, SQL+ is really meant to be an end user app and not an API that can communicate with other clients programmaticaly. That is why people have invented APIs such as `DBD::DBI` for Perl, `JDBC` for Java, ODBC etc. The way it is done is they invoke SQL+ and then parse the output, which is clearly designed for human eye consumption, using tools like `sed` and `awk`. The whole thing is at best a hack and very prone to bugs. Since this client is rather conservative with their technology, they don't want to scale their scripts up to Perl or Python where there are data access APIs. So I am wondering whether there are similar APIs for shell, e.g. K or bash. What I would like is if an API would return data in a 2-dimensional array or strings (for the lack of type setting) so that I can just read DB data like that. The way they do it now is akin to parsing regular web page HTML to get a single stock quote rather than cleanly calling a web service and be done with it. Anybody know of a product I can use? Thanks


Is this a test smell or is it even worse?

I have recently been looking at some testscripts which looks a bit like               ...     try {       receiveSomething();       // something was received even though it shouldn't       failTest();     } catch (TimeoutException e) {       // nothing should be received       succedTest();     }      The problem I have with these types of tests is   1. They are not deterministic. You don't know if nothing was sent on purpose or if everything has crashed.   2. Its very hard to simultaneously test something else, which might actually, in this case, send something. My thoughts are one the one side, how can this types of tests be designed better, and secondly can this be an indication of a bigger design smell of the software that is being tested? EDIT To clairify, these test scripts are used for black box-testing of event-based, complex software, not unit testing, and my feeling is that the 'doing nothing' event is a very ambiguous one. :)


Which layer should order the columns shown to the user when using MVC?

Say you want to render a table with five columns, but you want the order of the columns to be different depending on some specific parameter. This would be very easy to accomplish if the model sets the order. The view can then simply use a loop and create the table accordingly. However, unless I have misunderstood things, we want to let the view handle how things are rendered (although I guess there may a gray area involved here in terms of what the view "should decide how to render")? It also feels ugly to let the model set formatting / order, but maybe this is another thing I might have misunderstood? If the view is supposed to deal with the order of the columns, what is a good way to accomplish it (read: having to use a lot of if-statements and other ugly code in the view)?


Single product owner for multiple Scrum teams

Is that a common practice to have a single product owner for more than one Scrum team, or usually you have a product owner for each team (even if multiple teams work on the same product). Thanks


Use a setStatus($arg) function or have separate enable() and disable() functions?

I've got two functions at the moment:               suspendGroupsAndUsers($groupId){}     enableGroupsAndUsers($groupId) {}      But the difference between the two is one variable/string. Should I just have:               setStatusGroupsAndUsers($status,$groupID) {}      This feels more DRY... Or have the above two functions actually call the setStatus function? Gut says use setStatus ...


Design documents as part of Agile

At my workplace, we face a challenge in that "agile" too often has meant "vague requirements, bad acceptance criteria, good luck!" We're trying to address that, as a general improvement effort. So, as part of that, I am proposing that we generate design documents that, above and beyond the user story level, accurately reflect the outcome of preliminary investigations of the effect of a given feature within the system and including answers to questions that we have asked the business. Is there an effective standard for this? We currently face a situation where a new feature may impact multiple areas in our "big ball of mud" system, and estimates are starting to climb due to this technical debt. Hopefully more thoughtful design processes can help.


Haskell vs Erlang for web services

I am looking to start an experimental project using a functional language and am trying to decide beween Erlang and Haskell, and both have some points that I really like. I like Haskell's strong type system and purity. I have a feeling it will make it easier to write really reliable code. And I think that the power of Haskell will make some of what I want to do much easier. On the minus side I get the feeling that some of the Frameworks for doing web stuff on Haskell such as Yesod are not as advanced as their Erlang counter parts. I rather like the Erlang approach to threads and to fault tolerance. I have a feeling that the scalability of Erlang could be a major plus. Which leads to to my question, what has people's experience been in implementing web application backends in both Haskell and Erlang. Are there packages for Haskell to provide some of the lightweight threads and actors that one has in Erlang?


Perl: Negative look behind regex question

The Perlre in Perldoc didn't go into much detail on negative look around but I tried testing it, and didn't work as expected. I want to see if I can differentiate a C preprocessor macro definition (e.g. #define MAX(X) ....) from actual usage (y = MAX(x);), but it didn't work as expected.                   my $macroName = 'MAX';         my $macroCall = "y = MAX(X);";         my $macroDef = "# define MAX(X)";              my $boundary = qr{\b$macroName\b};         my $bstr = "  MAX(X)";         if($bstr =~ /$boundary/)         {             print "boundary: $bstr matches: $boundary\n";         }         else         {             print "Error: no match: boundary: $bstr, $boundary\n";         }              my $negLookBehind = qr{(?<!define)\b$macroName\b};         if($macroCall =~ /$negLookBehind/) # "y = MAX(X)" matches "(?<!define)\bMAX\b"         {             print "negative look behind: $macroCall matches: $negLookBehind\n";         }         else         {             print "no match: negative look behind: $macroCall, $negLookBehind\n";         }              if($macroDef =~ /$negLookBehind/) # "#define MAX(X)" should not match "(?<!define)\bMAX\b"         {             print "Error: negative look behind: $macroDef matches: $negLookBehind\n";         }         else         {             print "no match: negative look behind: $macroDef, $negLookBehind\n";         }      It seems that both `$macroDef` and `$macroCall` seem to match regex `/(?<!define)\b$macroName\b/`. I backed off from the original `/(?<\#)\s*(?<!define)\b$macroName\b/` since that didn't work either. So what did I screw up? Also does Perl allow chaining of multiple look around expressions?


Multithreaded Programming?

Recently I've finished learning about multithreaded programming on single shared objects, but was curious about how different things would be in order to successfully program on multiple shared objects?


What do I need to consider when using code under the Apache License in an application submitted to Mac App Store?

First off, I am new to licenses and app stores. There is an example app on a framework that has a `Class` file with much of the functionality I'll need for my own app. It's less than 1000 lines of code and distributed under the Apache License 2.0.   1. As far as I know I can use/modify the code and just acknowledge the developer and include the license, but does this mean my _whole_ project will be distributed under the Apache License 2.0 or just does it just apply to that source file?   2. Once my project is done, would I be able to publish my app in the Mac App Store? Would I be able to sell it there?  The file is from an example project that pretty much demonstrates all which is possible in the framework, and using it in my project would save me a ton of time. However, if this is not possible I guess I'll just have to code it myself.