instruction stringlengths 34 19.9k |
|---|
Who decided (and based on what concepts) that switch construction (in many languages) has to use break in each statement?
Why do we have to write something like this:
switch(a)
{
case 1:
result = 'one';
break;
case 2:
result = 'two';
break;
default:
result = 'not dete... |
Is it important for managers to give devs regular feedback on how they're doing and vice versa? I say vice versa because I consider employees to be responsible to their manager, and managers to be responsible to their employees. Everyone seems to think this is a good idea but in practice I rarely see it happen because ... |
In F# it is necessary to use the rec keyword. In Haskell there is no need to explicitly tell if a given function is recursive or not.
Given the role of recursion in functional programming, the F# design seems rather odd to me. Is it a good language design decision or does it only exist for historical reason or becau... |
Are there version control and project management tools which "work well" with freelancing jobs, if I want to keep my customer involved in the project at all times?
What concerns me is that repository hosting providers have their fees based on the "number of users", which I feel is the number which will constantly incre... |
Following this query on memento pattern, I have tried to put my understanding to test.
Memento pattern stands for three things:
Saving state of the "memento" object for its successful retrieval
Saving carefully each valid "state" of the memento
Encapsulating the saved states from the change inducer so that each state... |
I have the same web application running on several different servers.
Now I want a central place to administer everything in one web interface. What is the best way to do this?
Should I provide a REST interface on every web application and let the admin application make all the calls?
This seems like a common problem... |
Is it sane to let a read method on a file object to be const? For example
size_t read(void* buffer,size_t length) const;
The read method does not change the contents of the file, but updates the file pointer which is invisible behind a handle.
|
I currently am working on a project which has one large style sheet for about 20 pages. The style sheet contains some styles which are specific for certain pages. I'd like to break the style sheet up so there is one style sheet for each page with one master style sheet that handles everything generic. The reason I want... |
I am considering writing a new software product. Performance will be critical, so I am wary of using an interpreted or language or one that uses a emulation layer (read java).
Which leads me to thinking of using C (or C++) however these are both rather long in the tooth. I haven't used either for a long time. I figured... |
I was reading Why do we have to use break in switch?, and it led me to wonder why implicit fall-through is allowed in some languages (such as PHP and JavaScript), while there is no support (AFAIK) for explicit fall-through.
It's not like a new keyword would need to be created, as continue would be perfectly appropriate... |
The log files in question are metrics log files. One of them is a project file produced by SourceMonitor, to which I regularly add checkpoints to chart the progress of projects.
|
I am in the process of designing a small library, where one of my design goals is that the API should be as close to the domain language as possible. While working on the design, I've noticed that there are some cases in the code where a more intuitive, readable attribute/method call requires some functionally unnecess... |
I'm a beginner and have only little knowledge in programming.
Would it be good if I directly learn C++ from books which cover new C++11 or should I study through the old best C++ books?
Should I have little knowledge about C++ before learning C++11? or I can start directly from there?
Would it cause problem if I direct... |
Clean Code suggests avoiding protected variables in the "Vertical Distance" section of the "Formatting" chapter:
Concepts that are closely related should be kept vertically close to each other. Clearly this rule doesn't work for concepts that belong in separate files. But then closely related concepts should not be se... |
I'm new to Workflow developement, and I don't think I'm really getting the "big picture". Or perhaps to put it differently, these tools don't currently "click" in my head.
So it seems that companies like to create business drawings to describe processes, and at some point someone decided that they could use a state mac... |
I'm pretty bad with naming things.
The only name I can every generically come up with is 'helper'. Say, if I have a header file that contains helping functions for manipulating paths, I tend to put it inside my "helper" directory and call it "path-helper.hpp" or something like that.
Obviouslly, that's a bad naming conv... |
I have a betting type site where I publish a number (between 0-100) that is encrypted. Then after a period of time, I would review what the number is and prove it with a key to decrypt the encrypted number to prove that I'm not cheating. I also want it to be easily verifiable by an average user.
What encryption algor... |
Been struggling with this on an architectural level.
I have an object which can be commented on, let's call it a Post. Every post has a unique ID.
Now I want to comment on that Post, and I can use ID as a foreign key, and each PostComment has an ItemID field which correlates to the Post. Since each Post has a unique ID... |
I had a dozen interviews in my life (I'm about to graduate) and I wonder why I was only once asked to read and explain some code. Roughly, 90% jobs are mostly about maintaining existing systems. IMO ability to read someone else's code is an important skill.
Why don't interviewers check it?*
*Among my friends I am the o... |
There used to be very good reasons for keeping instruction / register names short. Those reasons no longer apply, but short cryptic names are still very common in low-level programming.
Why is this? Is it just because old habits are hard to break, or are there better reasons?
For example:
Atmel ATMEGA32U2 (2010?): TIF... |
Ok so in a programming test I was given the following question.
Question 1 (1 mark)
Spot the potential bug in this section of code:
void Class::Update( float dt )
{
totalTime += dt;
if( totalTime == 3.0f )
{
// Do state change
m_State++;
}
}
The multiple choice answers for this questi... |
Our company has hired five new junior developers to help me to developer our product. Unfortunately the new features and incoming bug fixes usually require deeper knowledge than a recently graduated developer usually has (threading/concurrency, debugging performance bottlenecks in a complex system, etc.)
Delegating (an... |
Intuitively it seems appropriate that the development environment (and all test environments) be as close to the production build as possible. Are there any documented arguments in support of this intuition?
|
This is my first ever DFD that I made after my fair share of learning but I have no way of verifying whether it is correct or not. Although I have taken utmost care to make sure it is right, I may be wrong.
Here is the scenario:
Bebop Records is a mail-order company that distributes CDs and tapes at discount prices ... |
Ok so I'm musing over a little side project I want to start. Essentially its a multi-session web based FTP client. Multi-session in that you can log into several FTP servers at the same time and perform operations like moving a file from one FTP server to another.
I'm doing this mainly to brush up on the new webdev tec... |
I've been a web developer for almost 10 years and I've gotten into the habit of trying not to use JavaScript whenever possible. I'm not talking about building web apps here, but database driven websites.
Is this a good/respected approach?
|
I'm reading about ASP.NET (VB.NET) and I want to built my professionally website. I'm wondering though; I'm still using the basics so I'm really just a novice, but how much should I rely on Visual Studio to create my elements?
Should I make my own text boxes and have my own login routine, or should I just use ASP.NET'... |
I'm reading up on JSF. One thing that I noticed is that tags such as h:inputText and h:inputTextarea auto-generate a random name.
Is there any way to over-ride this?
|
Is it safe to use LAST_INSERT_ID() in a system using MySQL like Point Of Sale when there are multiple users using the system at the same time?
|
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... |
The C2 wiki has a discussion of Empirical Evidence for Object-Oriented Programming that basically concludes there is none beyond appeal to authority. This was last edited in 2008. Discussion here seems to bear this out: questions on whether OO is outdated, when functional programming is a bad choice and the advantages ... |
I know the Ruby on Rails framework is only for web development and not suitable for desktop application development. But if a ruby programmer wants to develop a desktop application, is it suitable and preferable to do it with Ruby only (not jRuby, as most of the tutorials are for jRuby)? If yes, please provide some goo... |
so, suppose you have some fields and methods marked protected (non-virtual). presumably, you did this because you didn't mark them public because you don't want some nincompoop to accidentally call them in the wrong order or pass in invalid parameters, or you don't want people to rely on behaviour that you're going to ... |
I'm looking for a light-weight code review process. A couple of requirements, the reviewer must be able to do the review alone at the time of his/her choosing (not tied to check-ins), the reviewer must be able to easily find the target code, the review has to leave some document showing what was reviewed. I know there ... |
We all know the story of the personal computer as a consumer-oriented product. But I just thought that real end user solution should have appeared before that time. So a product that was probably expensive, but allowed using it as a service charging for it, for example computer-terminal for transport time-table access ... |
Can anyone name any usefull strategy/architectural pattern for allocating actions between different controllers when using MVC pattern for developing web application?
I am now developing web app using asp.net Mvc3 framework and still can't figure out how to manage actions and controllers. One approach is to create sing... |
In order not to redo things several times I wanted to factorize common stuff. For Instance, let's say we have a cow and a horse. The cow produces milk, the horse runs fast, but both eat grass.
public class Herbivorous
{
protected int Quantity;
public void EatGrass(int quantity)
{
var evt= Build.GrassE... |
Am about to start coding using microsoft .Net technologies, am just worried about the license, so if I compile my code using the .Net compiler "not visual studio" can I distribute, sell or use my product freely or I should have some sort of "microsoft license", same thing for sql server express installed(depolye) with ... |
In "The Clean Code Talks -- Unit Testing", Miško Hevery mentions that "as little work as possible should be done in constructors [to make classes more easily testable]'. It got me thinking about the way I have implemented my user authentication mechanism.
Having delved into MVC development through CodeIgniter, I design... |
Asking a job seeker to show some code is a fairly common practice for a software company. However, would it be acceptable for the candidate to ask the interviewer to show him a small piece of code that he thinks is well written?
|
Are there any FTP programs out there that do a file comparison as well, so I can select the local and remote files and see what actually changed? I didnt find any when I googled. But it doesnt seem like a very advanced use case to me. Surely many others would have felt the need for it.. right?
|
I'm looking to see if there is a particular name for this style of programming a certain kind of behavior into a program.
Said program runs in real time, in an update loop, and the program uses the State design pattern to do some work, but it's the specific way it does the work that I want to know about.
Here's how it'... |
An interesting point came up on another thread about alleged misappropriation of a GPL project. In this case the enterprise software was used by some large companies who essentially took the code, changed the name, removed the GPL notices and used the result.
The point was - if the company did this and only used the s... |
I work for a large humanitarian organisation, on a project building software that could help save lives in emergencies by speeding up the distribution of food. Many NGOs desperately need our software and we are weeks behind schedule.
One thing that worries me in this project is what I think is an excessive focus on cod... |
In my recent adventures in Scala, I've found case classes to be a really nice alternative to enums when I need to include a bit of logic or several values with them. I often find myself writing structures that look like this, however:
object Foo{
case class Foo(name: String, value: Int, other: Double)
val BAR = Fo... |
It was recently let slip that the new EULA for Delphi XE3 will prohibit Client Server development with the Professional edition without the additional purchase of a Client Server license pack. This is not to say the Professional version will lack the features, but the license will specifically prohibit the developer fr... |
We follow many agile processes, including automated tests, continuous integration, sprint reviews, etc... We're currently having a debate about how often we should branch release builds.
We've been doing two-week sprints and trying to deploy to production at the end of each sprint. Some of us think we should be branchi... |
Possible Duplicate:
How would you know if you've written readable and easily maintainable code?
It is often said that readability is perhaps the most important quality-defining measure of a given piece of code for reasons concerning maintainability, ease of understanding and use.
What defines the word readable in co... |
Possible Duplicate:
How not to degenerate into only a programmer who stitches together APIs?
I have almost six years of experience in java. I have developed many projects which used frameworks like Struts, Spring, Hibernate, JQuery , DWR, Ajax etc.
I have used these technologies in almost all the projects I have wo... |
My company is currently at a rebranding process and the brand names have been used in the sources' package names but these names are only visible to developers who maintain this code so nobody from project management is really interested in changing them considering also that it would imply the recompiling of several o... |
I am extending the functionality of a custom unix shell which I wrote as part of my lab assignment. It currently supports all commands through execvp calls, in-built commands like pwd, cd, history, echo and export, and also redirection and pipes. Now I wanted to add support for running a command in background e.g. $ls ... |
I am a RoR developer and want to clarify some doubt about ruby variable assignment.
In ruby we have two ways for variable assignment.
str, arr, num = "Hi", [1, 2], 3
and
str = "Hi"
arr = [1, 2]
num = 3
I know that the first way will go slower than second way but, I want to know that as per ruby language, which way is... |
Several months ago I was approached by a small business, who had seen my work previously and asked me to create a website for them.
Since then, the website hasn't changed one bit and I haven't heard a word from them. This sucks for them as they paid for a website and haven't used it. It''s frustrating for me because I ... |
I am recently working on a project aiming at evaluating whether an android app crashes or not. The evaluation process is
1.Collect the logs(which record the execution process of an app).
2.Generate formulas to predict the result
(formulas is generated by GP)
3.Evaluate the logs by formulas
Now I can produ... |
My father is a doctor/physician. About 15 years ago he started writing an application to handle his patient's medical records in his clinic at home. The app has the ability to input patient's medical records (obviously), search patients by some criteria, manage medicine stocks, output receipt to printer, and some more ... |
I am extracting interfaces from some classes in .NET, and I am not completely sure about what level of detail of description to use for some of the interface members (properties, methods).
An example:
interface ISomeInterface
{
/// <summary>
/// Checks if the object is checked out.
/// </summary>
/// <... |
If any application is scanning the ports of other machines, to find out whether any particular service/application is running, will it be considered harmful? Is this treated as hacking?
How else can one find out on which port the desired application is running (without the user input)?
Let's say I only know the port r... |
I have to refactor a complex C# app (many dialogs, mixed logic and so on).
There is a part managing the communication with special hardware equipments (sending commands and receive data via asynchronous c# callbacks). The code is "spaghetti" with mixed UI/Logic/Communication/etc and my task is to split the layers in a... |
I am designing a new system that has one central web service and several site web services which are spread across the country and some overseas. It has some data that must be identical on all sites.
So my plan is to maintain that data in the central web service and then "sync" the data to sites. This includes inserts,... |
Rhodes claims to be able to build Native apps but I'm not sure or not if this means a native shell + embedded Web Browser like PhoneGap or does it create a true Native app like (I believe) Titanium does.
|
The term will be used as a method name. The method is called when a part of the user interface is hidden (or removed), and it is used to reset values to default and dispose objects that will not be used any more.
Possible names are: release, remove, dispose, clear etc.
Which do you think is the most appropriate?
|
Obviously, small usability fixes and bugfixes go directly into the stable product. What about small new features? Can you afford to just release them after internal testing, or do they have to be betatested by customers first?
Situation: This is a young commercial project, produced by a one-person company. It has an ex... |
In my current team there is a practice of putting Epics under User Stories and sometimes even User Stories or Epics under Tasks! When questioned, the usual reply is: "if it is not a good practice then the project management tool would not have allowed doing so!" (IBM Rational Team Concert, for one does not prevent such... |
In my current team, where we run multiple scrums, the Story points are usually based on the effort required to complete the User Story. For example if an User Story has 2 tasks, both needing 5 days each, they the Story is assigned 10 points. So 1 day of effort is considered to be one Story point.
Is this practice a goo... |
If I am asked in an interview to write down some code, should I completely stick with C++ or is it acceptable to "mix" the two to write easy code as it comes to my mind?
I'll explain it: if I'm asked to create a "stack" data type, a C++ class is perfectly suited, while if I need to parse some strings a strtok/sscanf is... |
I was thinking about the XML format and the following quote:
“XML is not a database. It was never meant to be a database. It is never going to be a database. Relational databases are proven technology with more than 20 years of implementation experience. They are solid, stable, useful products. They are not going away... |
So I'm really wanting to improve how I architect the software I code. I want to focus on maintainability and clean code. As you might guess, I've been reading a lot of resources on this topic and all it's doing is making it harder for me to settle on an architecture because I can never tell if my design is the one that... |
I'm writing an app that will have an Image entity, and I'm already having trouble deciding whose responsibility each task should be.
First I have the Image class. It has a path, width, and other attributes.
Then I created an ImageRepository class, for retrieving images with a single and tested method, eg: findAllImages... |
I am a student who recently joined a software development company as an intern. Back at the university, one of my professors used to say that we have to strive to achieve "Low coupling and high cohesion".
I understand the meaning of low coupling. It means to keep the code of separate components separately, so that a c... |
Usually there is an @author tag in API documentation (JavaDoc, PHPDoc etc). Is it acceptable to use this tag on every function you make in a commercial product?
|
This question may be considered subjective (I got a warning) and be closed, but I will risk it, as I need some good advice/experience on this.
I read the following at the 'About' page of Fog Creek Software, the company that Joel Spolsky founded and is CEO of:
Back in the year 2000, the founders of Fog Creek, Joel Spol... |
The situation: We are about to roll out what is essentially a logging service. As we are rather PHP heavy, the current implementation use it.
We will have about 200 computers (most on the same network) that will each send, via HTTP POST, around 5000 requests/day. With each request containing about 300 bytes of data.
Th... |
In Test Driven Development, how do I make code bound to an ORM testable?
I am using a Micro-ORM (PetaPoco) and I have several methods that interact with the database like:
AddCustomer
UpdateRecord
etc.
I want to know how to write a test for these methods. I searched YouTube for videos on writing a test for DAL, but I d... |
I know very little about Smalltalk but I noticed that there's a frequent mention of the "kernel". Dan Ingalls prime maintainer of several implementations of Smalltalk also worked on a Javascript environment called "Lively Kernel" and in Peter Siebel's book he kept mentionning the "kernel".
I cannot help but think that ... |
http://w3techs.com/technologies/details/cp-flash/all/all
People don't use Flash anymore? Why?
|
Theoretically, thread-safe code should fix race conditions. Race conditions, as I understand it, occur because two threads attempt to write to the same location at the same time.
However, what about a threading model in which a single thread is designed to write to a location, and several slave/worker threads simply re... |
I have a collection of classes that I commonly (but not always) use when developing WPF applications. The trouble I have is that if I want to use only a subset of the classes, I have three options:
Distribute the entire DLL. While this approach makes code maintenance easier, it does require distributing a large DLL ... |
We use a detailed step-by-step user-interface regression test for our commercial web application. It has a "backbone" test for the most used / most important parts of the system, with optional tests for specific areas of functionality. Using this plan has definitely helped us ensure high quality software.
But, having... |
In some code I'm reviewing, I'm seeing stuff that's the moral equivalent of the following:
public class Foo
{
private Bar bar;
public MethodA()
{
bar = new Bar();
bar.A();
bar = null;
}
public MethodB()
{
bar = new Bar();
bar.B();
bar = null;
... |
As the title says,
How important is Discrete Mathematics for a Computer Scientist?
Background: I'm pursuing a Master's degree with a focus on fundamentals such as Algorithms, Complexity and Computability Theory and Programming Languages to get a good foundation for working in the field of Parallel Computing.
Some mor... |
According to ISTQB (and few more sources + wiki ), a defect/bug is the actual cause of error in software, e.g. incorrect statement, logical or semantic error. The actual definion is: a flaw in the system or component that could lead to the failure.
But what about specification bugs? I cannot relate to it. Specification... |
I don't want to get too philosophical here (like did God create God?), but how did Apple create Xcode? Would it have been possible for them to use Xcode to create Xcode? Or would they have to use another code program (and what might that be?). In general, how does that work with code editors?
|
I know how constructor and setter injection works in spring.
Normally I use interfaces instead of classes to inject beans using setter and I consider it as interface injection, but in case of constructor we also use interfaces (I am confused). In following example I use JobProcessor interface instead of JobProcessorImp... |
With some googling, I could easily find some documents in compiler design in C, Java, and C# and even in Haskell, but not in Lisp except implementing Scheme/Lisp in Lisp.
Is Lisp not so popular in implementing other (not functional) programming languages?
Do you know of some good documentation about implementing a comp... |
Accidentally I've stumbled upon the following quote by Linus Torvalds:
"Bad programmers worry about the code. Good programmers worry about
data structures and their relationships."
I've thought about it for the last few days and I'm still confused (which is probably not a good sign), hence I wanted to discuss the f... |
I am working on a small product based company developing .Net applications. There is a small team with 5-6 developers. I am a person responsible for planning everything. But my primary role is Software developer.
Now our current project is very unstable because of poor organization. Today my boss called me and told to ... |
So, I work in a company that does embedded software development, other groups focus in the core development of different products' software and my department (which is in another geographical location) which is located at the factory has to deal with software development as well, but across all products, so that we can... |
When there are no arguments, we have these two options:
$obj = new MyClass;
vs.
$obj = new MyClass();
I always pick the former, just because.
Any thoughts?
|
I am currently designing an n-tier solution which is using Entity Framework 5 (.net 4) as its data access strategy, but am concerned about how to incorporate dependency injection to make it testable / flexible.
My current solution layout is as follows (my solution is called Alcatraz):
Alcatraz.WebUI: An asp.net webform... |
I'm a student of computer science trying to soak up as much information on the topic as I can during my free time. I keep returning to algorithms time and again in various formats (online course, book, web tutorial), but the concept fails to sustain my attention. I just don't understand: why are algorithms so special? ... |
While solving the problems on Techgig.com, I got struck with one of the problems. The problem is like this:
A company organizes two trips for their employees in a year. They want to know whether all the employees can be sent on the trip or not. The condition is that no employee can go on both the trips. Also to determ... |
I need to draw a sequence diagram and I am not sure exactly if it is correct to show interaction between user and user interface in this diagram. For example I want to make a panel visible or invisible based on choosing a check box by user. Is it correct to have it on a sequence diagram? and how can I draw it?
thanks
|
Having recently completed a BSC (computer science), I am working as software engineer. With one year of experience, what educational options are available to me? I want to move further in management.
Please provide suggestions. I am considering a MSC but I got negative reply from lots of people.
|
In a book I have, there is a following classification of defect:
Critical : A defect receives a “critical” severity level if one or more critical
system functionalities are impaired by a defect with is impaired and there
is no workaround.
High: A defect receives a “high” severity level if some fundamental system
funct... |
I'm wondering about the differences between inheritance and composition examined with concrete code relevant arguments.
In particular my example was:
Inheritance:
class Do:
def do(self):
self.doA()
self.doB()
def doA(self):
pass
def doB(self):
pass
class MyDo(Do):
def ... |
Right now I'm reading Code Complete by Steve McConnell and in chapter 9 he talks about the Pseudo Programming Process (PPP).
From what I've understood, the PPP is a way of programming in which the programmer first writes the pseudo code for the routine he's working on, then refines it up to the point where pretty much... |
I have the following class :
public class Project {
private int id;
private String name;
public Project(int id, String name, Date creationDate, int fps, List<String> frames) {
if(name == null ){
throw new NullPointerException("Name can't be null");
}
if(id == 0 ){
... |
I'm facing a challenge understanding how to program a web version of a card game that is completely stateless.
I create my object graph when the game begins and distribute cards to PlayerA and PlayerB so I lay them out on the screen. At this point I could assume that HTML and the querystring is what holds at least some... |
Pretty simple question with a complex answer.
Should a project start with the client or the server, and why?
Where should a single programmer start a client/server project?
What are the best practices and what are the reasons behind them? If you can't think of any, what reasons do you use to justify why you would choo... |
Possible Duplicate:
What is a “side effect?”
I don't understand the wikipedia article on Side Effects:
In computer science, a function or expression is said to have a side effect if, in addition to returning a value, it also 1.) Modifies some state or 2.) Has an observable interaction with calling functions or the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.