New answers tagged programming-practices
1
Your manager probably is resistant to change because he sees no (business) value is changing practices. The business sees no real problem because whatever is asked of the development team eventually gets done and client complaints don't make it to the people that care and/or can do something to ensure a better result. Either that or the business has come to ...
12
Martin Fowler's quote is relevant: "You can change your organization or change your organization." Given that you've apparently decided to change your organization (make it better) instead of change your organization (work for a different organization), here are a few suggestions.
First, a lot of your course of action depends on details about the power ...
5
Sounds like it's time for you to learn about cash cows. Go here and here. And take a look at the Growth Share Matrix. The GSM provides some additional information on why cash cow is a good state to be in.
Investopedia (second link) probably has the best quote in this case.
A cash cow requires little investment capital and perennially provides ...
3
I think that this is a really hard problem with no direct solution. Here are some ideas on what you might try doing:
Fear of Change
On the subject of changing things for the better I get why management fears change. People are used to things a certain way and if you change it the users will revolt (maybe). Change is a scary things and usually requires a ...
7
The obvious short answer is to leave the company. Others have already left, and your manager is an active obstruction to progress. If you stay in that position you'll slowly decay (both in morale and skills). Finding a new job isn't always easy, but in this case it is necessary.
Just in case you chose not to leave the company (the first line of your ...
0
I am told that it is normally a good idea for a method to do two things, or for a method to have side-effects (like creating directory).
Well, it's normal that methods do more than one thing, i.e. we got used to it, but it is not advisable (generally speaking).
In your particular examples I see a very thin line between comfort/single responsibility and ...
0
The first two examples and the third one are quite different.
In the first two examples you first check a condition (if the path exists), and only then construct an object to return. This is absolutely acceptable.
What you do in the third example is retrieve data and check if the data is valid. I think this is over-complicated. It would be better to ...
1
There two general principles at stake here:
single responsibility
smart interfaces
It is always a good idea that one entity, method or class, have one responsibility, but the interface to any function or class should be easy to use.
If it should always be verified and especially if it does not make any sense to use the object, which you get without ...
0
The sole point of "one responsibility" is to make programs easier to understand for human readers. Computing a certain path and making sure it exists can be seen as two different responsibilities, but they are certainly very closely related; I don't see a risk of confusing your understanding here, particularly as long as the lookup routine stays as short as ...
3
What your methods are doing is not at all unreasonable. Its just unfortunate that their names are a bit of a mouthful.
For example where you have a method GetCustomerAndVerifyActive, surely you could call this GetActiveCustomer instead, and its easier on the eye? The new name doesn't detract from what the method actually does.
In summary I think your ...
4
You said you want something to think about to balance your viewpoint:
It's been several years, so I'm sure Boost has been improved, but we tried using Boost and it created memory and performance issues on one of our embedded products. So just because something is widely used doesn't mean it is a good tool/library for everyone.
On another product we even ...
0
I think you interpreted the pictures in a wrong way! The arrows do not represent call direction in my opinion.
When you look at the 2nd picture, it's obvious that Order Gateway Implementation implements the Order Gateway interface and objects of type Order Gateway are used from the client type POS. So the actual direction of call is top down as you would ...
0
There is not a singular right way to connect UI elements with each other. In most cases, the right way is determined by the UI framework that you use.
For example, in Qt it will not work to make all widgets direct children of the MainView, because they you can't arrange the widgets in anything more complex than "everything next to each other from left to ...
2
In my experience, it's usually no more difficult than making a list of everything that needs to get done, then each team member picking something off the list. If you both feel that the same task must be done first, then either work together or break it down further. If you estimate a task to take longer than 20 hours or so, it's probably too big, so break ...
3
First of all, use some kind of project management or bug tracking tool for your tasks. (e.g. Trello, Redmine etc.). That way you could see open tasks and the tasks you are working on. If you decide you need to add more people on the project, they can easily see all the tasks.
Dividing the tasks is the hard part. But some logical way is to separate the tasks ...
8
First of all, you need some sort of source code control. My company uses Team Foundation Server, but there is some free software out there (don't know which one is the best, so I can't recommend). Then, you need to have some sort of shared task list, so you can keep track of what's to be done and who's done what. There are some sites for that also, but I ...
2
Everything you said applies to commercial, close-source software too.
Updates: the difference is that FOSS code is much more honest about their incremental development schedule. Closed source world wants to to think their product is the last and final finished version.. with regular security updates and patches.. until the next version comes out that they ...
2
The only surefire way of handling this that I have found is to have a sense of pride in your craftsmanship. It's the same as a carpenter making say, a chest of drawers. The problem is essentially "solved" once he has the wood shaped how he wants it and fastened together to make a serviceable piece of furniture. The craftsmanship comes in with the sanding, ...
1
All you need to do is changing your perpestive on software development. Normally you shouldn't have to do that much of "small things" in the end, because most of these stuff needs to be done during the development period of each feature of a project.
For example if you are going to use the Agile software development method, you will find yourself developing ...
0
What do you mean by "pace at development?"
If you mean "implemented features per day" it is quite commonon that some features require more effort than others. This is often called the 80-20 rule or the Pareto_principle which claims that 80% of the work/features is done in 20% of the time and the rest (20 % of the work/features) requires 80% of the time.
...
3
The problem, I think, is that you know that you must do a lot of small tasks, but you don't know which exactly. So the tasks become an enigmatic mass of entangled problems, which weighs upon you and leads to anxiety, which leads to procrastination.
The goal is, then, to take stock of your tasks and structure them.
For example:
You've almost finished ...
1
I hate most standards documents as they usually try to sweat the small stuff and ignore the bigger picture.
For example, nearly all of them will say how to name variables or place brackets. This is pure style and does little to really help a group of devs code correctly. They ignore stuff like directory structure and code layout. I've seen standards ...
1
I was talking about something very similar to a co-worker of mine the other week. I was in a bit of a "funk" and wanted to get out of it. I asked him how he maintains his productivity. He explained to me that he maintains two lists.
A priority sorted list of stuff that needs to get done. This includes primary tasks, sub-tasks, wishlists, ....
A ...
4
The first important thing to note is that a coding standards document is not about right and wrong. It's not about good and bad or which method is better.
A coding standards document's purpose is to make sure that all code is designed, written and laid out the same to make it easier for a developer to switch from one persons work to another without the ...
7
What are the key aspects and contents of a good coding standards document?
Being supported by tools which enable automated checking of the code. If I know that I can't commit to version control any piece of code which doesn't match some rules, I would be encouraged to follow those rules in my code. If, on the other hand, some fellow programmer have written ...
3
I was going through this process multiple times. And the most successful (although bumpy anyway) was approach was to take "Coding Standards" document from well known company and modify it to fit your needs.
For example, I just found this one: http://www.tiobe.com/content/paperinfo/gemrcsharpcs.pdf
Anyway, keep your flame-thrower handy.
Cheers,
1
Instead of relying on the control-of-flow logic in your database, why not just get the data and handle it in your app code?
select userid, islocked, isremoved from [People].[User] where [UserId] = @UserId
Based on whether or not a record is returned or the values for IsLocked and IsRemvoed, you can update the data or generate errors.
I don't know about ...
1
Depending on your SQL implementation, you may have a RAISE, RAISERROR, or similar statement you can use in your query to fail the operation with an exception-like result. That's the best answer.
7
It's largely just par for the course for experience programming, and is one of the key reasons why programmers need quiet space and uninterrupted time to work. Simply put, you need to learn to keep quite a few different things in "working memory" in your mind.
There are aids you can use, though.
Task comments. Any editor or IDE can parse (or has a plugin ...
1
Do you have decent working conditions?
If you're working in open space, with a person nearby who constantly talks on the phone, people are walking all around, you receive new e-mails every five minutes and you can't ignore them, because they come from your boss, you're working on a slow PC where the compile time is about two minutes, etc., I'm not surprised ...
2
I bet node is null because your xpath query isn't returning any results.
Adding a null reference check should take care of your problem.
private void lstbox1_SelectedIndexChanged(object sender, EventArgs e)
{
btnDelete.Enabled = true;
if (rBtn1.Checked)
{
string xpath = "/Contacts/Contact[FullName='" + lstbox1.Text + "']";
...
1
Make sure you get input from the more senior member regarding security. Employee information is not public record.
Here are some time savers:
Management Brains - Are they aware this started as the 3 person job and is now down to one? Someone has to do the math and adjust.
Existing applications. There are a lot of ways to build an app, but some of your ...
0
This could be difficult.
I think planning is your key. Do you have a project plan that the three of you are working to?
If not, I would suggest you come up with one before your colleagues jump ship. At the very least this will be a list of all the tasks you need to do on the project. The more detail the better (up to a point - but just saying "develop ...
0
If you mean that the distinct types of tasks were first divided among three, I suggest you request a weekly session (several hours) with the senior engineer to discuss progress, issues, ideas. It would be very unwise from the company standpoint to let you do it all alone, regardless of your level of expertise.
2
I guess both are useful, but your coding on your own will be better.. Other's code will help, you will get to learn some things you couldn't have thought of but at that transition, it's how you think that matters.
It would be better if you take a few problems and solve them. Use other People's help when there are any problems that you can't get around. ...
1
Absolute majority of programming work is done in a team and involves code base that already exists for some time and needs to be continuously adjusted for new requirements and features. You won't ever learn that from text book, you have to try it.
Working with other people's code is also great way to get experience how various idioms work in practice. You ...
2
It's often handy to have domain-oriented methods to find / slice collections, as in the FindByCarModel example above, but there's no need to resort to creating wrapper collection classes. In this situation I will now typically create a set of extension methods.
public static class CarExtensions
{
public static IEnumerable<Car> ByModel(this ...
4
I think the most important aspect of learning is failure. When you attempt to adapt example code or implement something new and it doesn't work, you have to figure out why it doesn't work.
This is when your brain will be put to work attempting to solve the problem you have come across. And when you finally have that 'aha!' moment, what you have learned ...
0
Create a structure holding all your global variables which you want to use in many method parameter.
5
Reading other peoples code all the time is a sure shot way of improving your skills on the project. No doubt about it.
It also helps to be the dumbest guy in the team - by that I mean to say that if all the other programmers in the team are way above you in terms of programming skills it will automatically lift your level too - as long as you have the ...
11
I think you need a proper project: Find a problem to be solved, and solve it.
Doing something real (rather than hacking examples) will drill into your head all kinds of lessons: things that you have been taught that are good, things that don't work so well.
The biggest difficulty in a real project is not so much writing code, its knowing what code to ...
8
Prior to generics in .NET, it was common practice to create 'typed' collections so you would have class CarCollection etc for every type you needed to group. In .NET 2.0 with the introduction of Generics, a new class List<T> was introduced which saves you having to create CarCollection etc as you can create List<Car>.
Most of the time, you will ...
1
I think that the only reason to create a special class for holding a collection of other items should be when you add something of value to it, something more than just encapsulate/inherit from an instance of IList or another type of collection.
For example, in your case, adding a function that would return sublists of cars parked on even/uneven lot ...
8
No. The creation of XXXCollection classes pretty much fell out of style with the advent of generics in .NET 2.0. In fact, there is the nifty Cast<T>() LINQ extension that folks use these days to get stuff out of those custom formats.
1
Callbacks have been around since the early days of Fortran, at least.
For example, if you have an ODE (ordinary differential equation) solver, such as a Runge-Kutta solver, it might look like this:
subroutine rungekutta(neq, t, tend, y, deriv)
integer neq ! number of differential equations
double precision t ! initial time
double ...
1
Firstoff, the term callback refers to a closure that is being used for something.
For example, suppose you create a closure function and just store it in a variable. It isn't a callback, because it isn't being used for anything.
But, suppose you create a closure and store it somewhere that it will get called when something happens. It is now termed a ...
1
What happens without callbacks:
Guy 1: Okay, I'm waiting for that thing to happen. (whistles, twiddles thumbs)
Guy 2: Dammit! Why is Guy 1 not showing me stuff? I want to see stuff happening!! Where's my stuff? How is anybody supposed to get anything done around here?
1
I don't know lua but in general callback methods some what like multithreading.
For example in mobile application development programming most of the applications are functioning like sending request to the server and playing with UI with the data came as response from the server. When the user sends a request to server, it will take time to get response ...
27
Guy 1 to Guy 2: hey dude I wanna do something when a user clicks in there, call me back when that happens alright?
Guy 2 calls back Guy 1 when a user clicks here.
5
Why we need call back functions? what situations can I apply this to?
Callback functions are very useful in event-driven programming. They allow you to set up your program in such a way that events will trigger the correct code. This is very common in programs with GUIs where users can click on any element on the UI (such as buttons or menu items) and ...
Top 50 recent answers are included



