My apologies for being so silent recently. I think this has actually been the longest I've gone without making any big changes to DaniWeb in as long as I can remember.

As many of you know, I've been hard at work on my new project, Dazah, these last couple of months. Unfortunately, I have found it incredibly difficult trying to shift between DaniWeb and Dazah. I wrote both platforms from scratch using PHP's CodeIgniter framework, but beyond that, they have been done very differently. Each time I try to switch back to DaniWeb, I get incredibly confused and forget how things are all set up.

For those of you who contribute to multiple projects, or have a big project on the site from work, do you have any techniques to help me keep track? The two platforms have things in all different places, but they're similar enough that I keep confusing them for each other.

Recommended Answers

All 19 Replies

I probably don't have to tell you that your code needs a lot of comments to document it. Avoiding useless comment like "This is an if statement" etc.
In the previous century (the owls could still speak sometimes :o) ) we used to keep some sort of diary where we noted every day on which part of the project we did some work.
Phew, perhaps you'd have to keep two?
Hope this 2 cents of advice helps a bit. Success!

In the previous century (the owls could still speak sometimes :o) ) we used to keep some sort of diary where we noted every day on which part of the project we did some work.

I do the same, I set up a sort of wiki (an index, a search, CRUD forms with Textile) in which I write about everything I develop, from database table schemas to project definitions.

commented: Yes! +0

I probably don't have to tell you that your code needs a lot of comments to document it.

I would say that my code is well-commented, and if I reread it, I can pretty much follow it. The problem is that I used to eat, live, and breathe DaniWeb code and only DaniWeb code. If I needed to do or change something, I knew every line of code like the back of my hand, knew instantly what needed to happen, and got it done super quick.

For the past 3 months or so, I started coding Dazah from scratch. I've learned a lot since creating DaniWeb's platform, and I've structured things a bit differently from the ground up. For the last month and a half or so, I've pretty much been eating and sleeping Dazah.

Now, each time I want to make a quick change to DaniWeb, it takes me a long time to get my bearings. Just the simplest things, that for 14.8 years of the past 15 years would have taken me no longer than 5 minutes to do, are suddenly taking me 20 minutes because I find myself checking three files before I remember where a particular method lives. Or, I need to make a quick HTML change and I accidentally catch myself using Dazah's CSS classes instead of DaniWeb's, and it takes twice as long because I need to rewrite it. I get so frustrated with myself that I've "lost my touch" so quickly and it demotivates me.

In my company, we are developing our own lightweight framework. Far lightweight than CodeIgniter but more modern than CodeIgniter (our framework size in total is around 20kb). The framework learning curve is at most 2 hours to 3 hours which is great because the less feature the framework, the less confusing the code is.

As project grow larger and larger, we will need help from IDE. We are using NetBean IDE which has great auto completion for PHP.

I also regularly refactoring the code. Try to see the pattern and make the code shorter. For example, our pagination look like this.

 $this->view->pagination = new Pagination(array(
          "data" => array("News", "getNews"),
          "count" => array("News", "countNews"),
          "itemPerPage" => 20
  ));

This code is enough to generate the whole pagination functionality of the whole page. The pagination will analyze the current page position and call News::getNews accordingly. We also make use of extends a lot to make thing more simple.

 class OrderController extends AuthController
 {
         public function delete($id) {
                $this->require_permission("order_delete");
                $this->require_password();

                Order::delete($id);
         }
  }

Even without comment, it is easy to understand the code. First, we check if current user has permission to delete the order. Then, prompt with a password textbox for user to type their password to confirm the deletion.

Therefore, keep the code as short as possible and as descritive as possible.

Another thing that we make thing far simpler is how we manage our image. We develop multiple sites. My eCommerce site has over two millions images and my news website has nearly six hundred thousand of images. Previously, each website maintains image differently. Now, I strip out all the image uploading functionality from all website. Then, create new server that manage all the image. The image server provides an upload API to all the site. Now, instead of maintaining the codebase for image on each website, I only need to manage the images server. This is how it works.

Original image
http://s3.kh1.co/5a47250b04ba7c9bac045fa43bffd2fe0b1a746b.jpg

Ability to generate thumbnail on fly
http://s3.kh1.co/5a47250b04ba7c9bac045fa43bffd2fe0b1a746b.jpg?m=thumb&w=182&h=254

In short from my experience:

  • Try make code as short as possible and as descriptive as possible
  • Make use of your IDE
  • If possible, break some functionality into different small project.
Member Avatar for diafol

I truly sympathise Dani. Hit the wall a few times this year with simultaneous projects, while balancing other income streams. One project (about a month's work) had to be done from scratch as it was thrown up so quickly, I totally lost the plot - scope creep, poor structure, half-arsed commenting, new framework, which I upgraded half-way through (urgh!). I began with a diary-type thing, which quickly became less and less useful. Tears don't even begin to describe it.

I wish I'd seen cereal's post before I started!

My career at Manitoba Hydo was about 20% developing/maintaining new applications and 80% maintaining/enhancing applications/systems developed by others. You have to context switch between only two systems, both developed by you. While I am sympathetic, trust me when I say it could be a lot worse. You can also trust me when I say it that context switching gets a lot easier the more you do it.

I switch between projects and I find keeping a note of the current state of things helps. I use the Microsoft OneNote for this but I think any basic text editor should do the job.

As far as working with code is concerned, in case I need to drop off a project and move on to another task, I ensure that I type in junk characters and then close my workspace. This ensures that I get compile time errors when I next open the work area which serves as a reminder of the stuff I was working on. ;)

There's a good degree to be said for the psychology that could be applied here,

In my kitchen I know where everything is, but it surprised me how quickly I lear ned and adapted to my wife's parents kitchen. Even though it's a completely different place with different utensils, it didn't take me long to get used to both kitchens. The reason? Both places are too different to be confused with each other.

Please don't get me wrong I'm not suggesting you need another house, but you may find it helpful to create a separate, different, work environment. This could be a different computer all together, or a different user account on the same computer. How different could you make either work environment? Too many similarities often makes things confusing, as you've discovered.

Draw a map of Daniweb, and make it your mapping method. If you really do think a flowchart would do it, okay. But, a flowchart could be too formulaic and too much work. A few swipes of a pencil on an A4 page or with a stylus in OneNote and you have enough visual cues. Do the same with Dazah, well, the same but different. :-)

Too many similarities often makes things confusing, as you've discovered.

Both sites are using the CodeIgniter PHP framework, similar database structures, and the same custom-written ORM. The biggest difference is that I have grouped things together differently in Dazah (a bit more organized). Therefore, I keep forgetting where things are in DaniWeb. Ugh! What a pain. I'll figure this one out :)

After serious thought, I've decided to take the time to completely refactor DaniWeb's code to operate off of the same codebase as Dazah. This process will take about 2 months and there won't be any noticeable changes (aside from some speed improvements), but I think it will be worth it in the end.

This will allow me to quickly and efficiently flow between developing for both sites. Additionally, I won't have to maintain two codebases. This is significant as I'm already having a hard time keeping up with upgrading the third-party libraries we are using X 2. Keeping everything with the same version of the Markdown parser, GeoIP database, etc. will be a huge step towards maintainability.

Something else that it will allow is the ability to seamlessly integrate DaniWeb and Dazah functionality. With DaniWeb's declining revenue and Dazah's quick growth, I can leverage each off of the other. This will allow me to ensure that DaniWeb not only doesn't suffer, but rather benefits, as I focus all my time growing Dazah, which I think has more future revenue potential.

We shall see! :)

I've decided that in order to effectively continue DaniWeb, it's imperitive that I get it on the same modern framework that I have Dazah on. This will allow me, as a single person, to effectively maintain both systems.

From a business standpoint, both businesses benefit by having the ability to integrate, as well, because they can both leverage each other, which helps me not have to shift focus on one over the other.

However, DaniWeb isn't generating enough revenue right now in order for me to spend such a significant amount of my time on its backend, working on something that isn't going to directly affect revenue.

I'm thinking of running a donation drive in order to help fund the massive infrastructure upgrade.

DaniWeb has always received so much "free" traffic from Google of people that come in, read an individual forum thread as a result of their Google search, and then bounce back to whatever they are working on. In other words, they aren't in the mindset to start signing up and joining the community.

We have always relied on paying for Google AdWords advertising to bring in all of our new blood into the community. We advertise to people who are in a different mindset and not when they're in the middle of trying to solve their frustrating problem.

All of the free traffic brings all the advertising revenue from people reading all the content. All the traffic we pay for keeps the community growing and constantly brings in fresh blood, and supplies all the people who do the posting.

The problem is that as revenue decreased over the past few years, I stopped investing in Google Adwords. As a result, we stopped bringing in fresh blood into the community, which is the cause of the community dying.

What I am proposing is running a huge donation drive in which 100% of what is brought in would go solely into refueling our advertising efforts. This will jump start our community with new blood, and give me motivation to recode the backend, allowing me to continue effectively maintaining the site.

Thoughts? Do you think this is an effort a significant portion of the community could get behind?

Do you think this is an effort a significant portion of the community could get behind?

Doubtful. For someone donating there is usually a "what's in it for me". What would an average user gain from donating?

I am guessing that with "significant" you mean a lot more people than the regular posters combined with the fly-by one question posters. A lot of the regulars already donated (and may do this once again), but the one hit wonders only care about their question at this time. Do they really care about getting more people in to maybe answer their next question? No.

Currently, we receive a couple hundred bucks a month, on average, in donations. To put that into perspective, web hosting costs are over $5000/mo.

My thoughts are effectively putting a big banner at the top of every page of the site for, say, a month, and running a donation drive Wikipedia style.

As far as "what's in it for me" ... Well, I'm betting on at least a handful of DaniWeb lurkers finding enough value in what they read to donate even a dollar.

And by "significant" I mean enough to fuel starting up a new ad campaign to kickstart the community growth back into gear. Effectively, it would rejuvinate new blood into the community and give me the motivation I need to invest a significant portion of a couple of months into the backend.

Alternative suggestions?

a handful of DaniWeb lurkers finding enough value in what they read to donate even a dollar

That would be a handful of dollars. What amount do you need?

Alternative suggestions?

No, am no marketeer. I didn't want to bash your idea, hope that's clear.

web hosting costs are over $5000/mo

I'd change my host, that's just ridiculous. Is it hosted on the moon or something?

Our traffic has declined over the past couple of years, but it's still way up there. At one point we were one of the top 1,000 most heavily trafficked sites on the entire web, ranking just above ToysRUs.com. It takes a lot of server power. Plus, our database only grows in size. 15 years worth of data accumulated!

Member Avatar for diafol

Cloud hosting cheaper than diy? Just askin. Wrt donations. I think dw needs to re-establish its core audience. As sos said in a recent thread the landscape has changed. Is DW appealing to the right audience? What is the audience? For what its worth I.ve seen a huge difference in the number of posts (php) but not sure that this is reflected in the stats. However many of these are noob-level posts that are beginning to bore me. Not much in the way of intermediate-level posts. How to encourage this section of the possible audience to contribute?

Cloud hosting cheaper than diy?

Have tried pricing out cloud hosting multiple times over the years. It's always come out way more expensive, because you pay for what you use, and we use a lot, apparently.

We did successfully renegotiate our contract a couple months back and were successfully able to shave off a couple grand by switching to cheaper hardware and migrating from a private load balancer onto a shared load balancer with our hosting company, among other things.

As sos said in a recent thread the landscape has changed.

It's allllll due to me no longer investing advertising dollars in bringing in new community members.

Over the past 15 years, everyone who has posted was always due to paid advertising. All the traffic as a result of free Google searches just adds to our advertising revenue, but these people don't stick around in the community.

Cutting off spending ad dollars has directly influenced post quantity and quality.

web hosting costs are over $5000/mo

Are you sure you spend $5000 per month for hosting? I am running a website with as much as traffic as Daniweb (if not more) and it costs around $300 per month.

  • We are storing our images in DreamObjects. Have over 3 million of images (around 300gb). Then using Cloudflare to cache the images to reduce the bandwidth costs. It costs roughly $30. 7 terrabytes of bandwidth for image per month.

    Screen_Shot_2015-12-22_at_8.19_.29_PM_.png
    (This is bandwidth of our image server only)

  • We are using 8 servers from DigitalOcean. Some are $10 server, some are $20 server. some are $80 servers. It costs around $300. Our database is not big. It is around 3gb of data. 3 terrabyte of bandwidth per month.

    Screen_Shot_2015-12-22_at_8.28_.22_PM_.png

commented: for sharing data and prices +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.