Tag Info

Hot answers tagged

128

"Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live." (Took it from here) That said: there is no level of »excessive« for code reviews. I'm a newbie programmer working internships and learning a lot from experienced programmers What is more important than writing code is reading code ; read ...


70

Let me quote from Page xxii (Foreword) of "Clean Code" by Robert C. Martin from Prentice Hall. Back in my days working in the Bell Labs Software Production Research organization (Production, indeed!) we had some back-of-the-envelope findings that suggested that consistent indentation style was one of the most statistically significant indicators ...


27

I am very much like your mentor. I treat all code reviews for developers of any experience the same way, even if I wrote the unchanged code I'm complaining about myself. It's no reflection on you or your abilities. Often, the problems with a design are not apparent until you try to modify it. Alternately, a design might have been perfect before the ...


24

The short answer is that the page's client-side Javascript code detects when you get "too close" to the bottom of the page, and asks the server for more data when that happens. Without getting too technical, they are not reloading the entire web page. Instead the Javascript code on that page is requesting more data from the server, then when it receives the ...


21

To tell you a little about myself, I'm a newbie programmer working internships and learning a lot from experienced programmers [...] This sentence it seems to me is the key to the answer. I manage teams of programmers. When I do code review with programmers in general (of good and not so good levels of skill) I will get them to write code to meet or ...


20

One big key to understanding what is happening: It is possible, via Javascript, to set the URL in the addressbar without actually redirecting the user. To see this in action, paste the below code into a supported browser's console. Notice that it changes your address bar to http://programmers.stackexchange.com/yay.html. ...


14

First things first - there is very rarely a single "correct" way to do something in code. So your creativity always matters. That said, there are a whole lot of bad ways to do something in code. Ways that will cause you (or others on your team) issues in the future. Sometimes immediately. So code quality is very important, since poor code quality tends to ...


10

Combining resources is one way to potentially improve performance for a web site. Let's look, though, at what happens when we take this to the extreme hypothetical you pose. Size Savings? We can Base64 encode images and put them directly into an HTML document. The first problem, though, is that Base64 encoding a binary object increases its size by a factor ...


9

Your mentor may be an excellent coder, but... Does he have the authority to review and change all the code? Is he potentially imposing stylistic changes on functional code rather than fixing bugs/preventing dangerous behavior? Are the changes being made backed up by unit tests and/or functional tests? Was there significant unit test coverage before the ...


8

There are two issues here: The issue of your mentor disliking your solution is hard to qualify without concise examples. Maybe if you posted your code, you would find that everybody agrees with your mentor and that you are using the wrong approach (do not worry about it, the fact that mentors exist is the prove that most people need to get some actual ...


6

for the first time feeling like I get close to being competent. I've been programming for over twenty years, and every year I wind up saying that to myself at least once or twice. anything takes a whole lot of time because I have to find the best way to do it or else its a waste of time, it also feels like my creativity doesnt matter because there ...


6

"Done is better than perfect" I hate to break it to you, but code can always be made better, code is never perfect. If you think your code is perfect, you probably haven't looked at it enough yet, or you're no real engineer, as a real engineer can always make things better than they are. (Or, in the programmers lingo, a real hacker can always make things ...


3

The way this is normally done is with user roles and a role access matrix. Each user has a role, saved in the database along with the user name, password, etc. Then, there is a two-dimensional role access matrix somewhere, specifying for each role and for each screen field what kind of access is to be had by users who have that specific role on that ...


2

Your mentor is taking his role seriously; you should always appreciate that. By holding you to a high standard, he is helping you develop the practices and proficiencies that will serve you well in your career. By pointing out errors made by others, he is helping you better recognize bad code so that yours will more often be better. To become expert at ...


2

You have a mentor! Wow, great first step. At least somebody cares. The thing about writing code is that any idiot can do it. And a lot of idiots do. The difference between idiot code, and good, clean, maintainable, documented code that works well and is easy to maintain... a bit like the difference between chalk and cheese. Things like coding standards, ...


1

At least w3schools is right on this. It is indeed wiser to have a downsized image, or even several downsized images if you site needs it. Note that you may even want to have the "full size" image smaller than the user uploaded image. You will have guessed that these images being user uploads, you'll need some kind of script to generate the thumbnails on ...


1

found this from W3Cschools: Tip: Downsizing a large image with the height and width attributes forces a user to download the large image (even if it looks small on the page). To avoid this, rescale the image with a program before using it on a page. I guess I've already known the answer - create separate thumbnial for each image uploaded.


1

Is my mentor's concern for code quality excessive? Possibly. Your statement that only one (his) version of solving a problem hints to it. But then he probably is way more competent than you are right now, so it might just a (wrong) impression that you get. Others have pointed out how what he does sounds perfectly reasonably. But it shouldn't really ...


1

When I mentor I always need to keep in mind that my pov is not the absolute truth. Design is still a creative process, but the more I learn the more I put constraints on my creativity, which I don't think kills creativity, it actually makes it stronger. Some of my ideas are still experiments and I can't enforce those to newcomers. Leaving aside "the ...


1

For example, I just read about CGI scripts. Now, usually when I see people talk about web application programming these days, they're using some framework for Ruby or Python or even PHP. CGI is considered by most to be an outdated technology these days for anything but the simplest applications, some of your reference material may be outdated. How ...


1

While not really a pattern per se, the main thing I'd do here is separate the code from the data. By "data", I mean which sections should be shown or hidden for each dropdown item. var sectionsToShow = { item1: [1, 2, 3], item2: [2], item3: [6, 4, 5], ... }; Then your dropdown handler can (ideally) do something like ...


1

First off, be aware of the Inner platform effect and do everything in your power to avoid it. Even if you do go the ultra-flexible route, the key to actually succeeding is ironically to fully understand its pitfalls. However, if a platform of this flexibility is truly what is needed/what management knows it thinks it wants... at least avoid reinventing the ...


1

My client sells a case management system that works in exactly that way. All accesses to all fields are controllable. It is perfectly usable, although for performance reasons the permissions are cached in the application and updating the database would not have an immediate effect (but a rapid refresh mechanism could be implemented with triggers if ...



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