Tag Info

Hot answers tagged

190

You have stumbled on the achilles heel of most CS educations: they teach you the tools and techniques, but not the trade. Building software is a craft, one which you only acquire through years of practice and the experience of having your software used (users are much harsher critics than teachers). Building software is also quite often a business, one where ...


89

Sounds like every second system that has been thrown at me to fix. Relax, this happens to a lot of people. A junior thrown in at the deep end with no experience, who has no help, no support and no guidance isn't exactly a recipe for success. Hiring and expecting a junior programmer to build a brand new system from scratch that works well, performs well and ...


48

Whenever you start from scratch again, you'll almost certainly make the same amount of mistakes (or more because the Second System Syndromme tends to kick in). They will be different mistakes, but there will be similar amount of time to spend with debugging and similar despair about how it's not a good fit. It will also delay deployment into production (or ...


21

I forget where I first read it, but I just wanted to echo, somewhat more forcefully, what other people have said: Shipping is a feature. There is nothing worse than that one guy who keeps "cleaning up" existing (possibly hacky, ugly, dirty) code that works perfectly well, introducing new bugs, etc. What matters in the real world is getting your job ...


20

Every project leaves you smarter than you were before. After every project you will have accumulated more experience which would have been very handy when you had it from the start. I know that it is hard to not revisit everything and apply what you have learned. But remember: Perfect is the enemy of good. For the client it is always better to have a good ...


14

I [...] read Uncle's Bob clean code. I'm having this persistent thought that I have to rewrite the whole project. This book has a section named, very appropriately, "The Grand Redesign in the Sky". Don't try to rewrite everything because, in the unlikely event that you have the time to make it, you will face the same problems anyway. When you ...


12

At runtime, it does not make a difference. The point is readability - as a member variable, it likely is declared at the beginning of the class' source code, and making it static means it doesn't have to be allocated for each new instance of the class. Making it final signifies to the reader that the value will not change (to the compiler too, but that's ...


10

It is considered to be best practice to arrange the condition such that it is most probable to be entering your if clause. The <50% condition should be your else clause. In this instance, it depends on what you're expecting. If you expect to find the file, then you should use if os.path.isfile(file_name):. This reason stems back to optimization of ...


9

You're doing good. You say that your code works, and it's almost ready to ship, right? And you perceive that your code may be vastly improved. Good. Your dilemma much reminds me of my first experience with freelancing (getting hired while in my 2nd year at uni to create a multilingual POS system). I went through endless questioning as I was never satisfied ...


8

Objects that are passed around to other methods can be changed by the method, and the caller will notice the change. If you let someone else use your Stream, they might close it and you'd never notice until you try to write and fail. That's why it's usually a good idea not to pass mutable objects around outside your control. Confusion often arises because ...


7

No. A UUID has a particular, standardised format. From the wiki article on the subject: In its canonical form, a UUID is represented by 32 lowercase hexadecimal digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and four hyphens).


7

There is 0 difference. However, there are some guidelines about what you put in the if and what - in the else. One is that you should try to put a "positive" result in the if. Many languages have shorter negation than " not " (Java has "!" that shouldn't have whitespace around it), and it's easy to overlook them, especially if you're looking at a verbose ...


7

Then don't. They are expecting you to do more. Given free reign, a set of data, and a customer, you should be able to come up with something relevant and useful. If nothing else, you should be able to curate the data into a well-formed database, so that when someone has a question to ask about it the answer can be easily retrieved. (Being able to ...


6

I have been told that a good practice for writing methods is to make the method only responsible for doing one thing. The common problem people have with this is that they take it too literally. If a function can only ever do one thing, how do you ever do more than one thing ever? If your "one thing" takes 5 steps, then make a single function that ...


6

Most of what I would say in response to your question has been said by others. Read "Things You Should Never Do, Part I" by Joel Spolsky (along with some of his other posts about "architecture astronauts"). Remember that "the perfect is the enemy of the good". Learn to refactor incrementally. Shipping is important, etc. What I would add is this: you've been ...


6

The point of an internship is to learn. I would refactor the code to be better and ignore the assumed limitations of people you don't know. For all you know, the company will move that project to an internal team rather than interns soon.


6

There are two things of note here: you seem to know quite a bit about good practices and the project is meant to disappear "soon" (though not right after you leave). As Telastyn mentions, make the most out of this experience to learn what works and what doesn't and how to apply best practices in a real-world environment. Think about yourself first. That ...


5

If newMethod never changes its value after initialization (it could be declared const or readonly, I guess), you should better write a standard private method. Using delegates without a reason can make the code confusing (at least in C#), even for experienced programmers. Comparing private Action<Enum, int, int> newMethod = (configField, fieldA, ...


4

If you're really interested in the dilemma you have, you should also read "Lean Startup". A lot of the advice that you're being given here will resonate with you more if you read that book. Basically, resource burn-rate is your worst enemy and nothing is more valuable to you and your organization than end-user/customer feedback. So, get your product to a ...


4

For reasons that others have thoroughly explained, it is time to finish the project and ship it, painful as that may be. I would just like to emphasize that testing the app is also part of "finishing" it. If significant pieces of functionality haven't been thoroughly exercised and correct results confirmed, then you're justified in your concern that people ...


4

How to document code? You already have a hint: look at how Java API is documented. More generally, there is no unique set of rules which apply to every project. When I work on business-critical large-scale projects, the documentation has nothing to do with the one I would write for a small open source library, which, in turn, has nothing to do with the ...


4

tl;dr I suggest static methods, or even instance methods can be alright depending on the objects you're working with and how long lived they are as well as how stateful they are. Do not use properties for this. Properties should be as idempotent as possible (repeated access should return the same result constantly). If A property needs to execute logic to ...


4

This is fundamentally a cultural issue. First of all, be careful of thinking you can "prove" that a different methodology is better. With time and experience, you'll get better about "persuading" your colleagues about better practices. The problem is that the people in a shop develop certain habits, and come to certain shared understandings, and become ...


4

I'm not sure how far you've got with your design. Your description of "hole-punching" does not ring exactly true. AS I understand it, the server has no need for client IPs except when they are on-line and available for connection. Each client connects to the server, thereby providing a current IP location and NAT channel. A user wanting to call another user ...


4

A build machine is the way to go, even for small projects/teams. Get any random spare machine (ie. an old dev box). Install some continuous integration software on it like jenkins or teamcity. Done It's been a while since I had to set one up or maintain a build machine, but unless it's gotten worse since a year or 2 ago, you can have continuous builds ...


3

The proper answer in 2014 is none of the above. First, that default file save location has no real meaning in life -- I suspect it is just Microsoft following their own rules about where programs should save things by default. As for how to deal with cross-cutting dependency projects, the right answer is to treat them as projects in their own right with ...


3

Almost by its nature, Open Source software tend to have less in the way of rules and more in the way of guidelines. There's also a fair amount of etiquette, politeness and respect to make things easier. The main points that I consider when I am contributing to open source software are: respect the standards used in the code, whatever they are (within ...


3

Login using AJAX, jQuery and PHP: http://stackoverflow.com/questions/14449118/php-ajax-login Personally I think PHP is barbaric. The only acceptable use is if you're using a framework like CakePHP or Laravel. My preference is Django Python or Node.js. But there is no disadvantage to which backend you use. Each language has its strengths and can perform ...


2

This is the problem closely related to the job scheduling. But there are two issues you have to consider: 1) Your clients are free to choose any job they want. They know when new jobs arrive and can pick any one they want. If you really want to control what they do you should really limit what they can know and reserve for processing. 2) Before really ...


2

If I understand your question correctly, I think the following approach should work: If a client ignores a notification once, because of its load, it ignores all following notifications too (even if the load decreases). From then on, it relies only on querying the database for old requests. Once all old requests are handled, it will start accepting ...



Only top voted, non community-wiki answers of a minimum length are eligible