Real food has the advantage of releasing energy much more slowly than energy gel/bars. This is the best foundation for avoiding the bonk in the first place, but to do this you must chose foods that are high in carbohydrate and low in refinbed sugar/simple sugars (to avoid very fast energy release and then a blood sugar drop afterwards) and also eat regularly. Chose wholemeal over white bread at cafes and the energy from it wil be relased over a longer time period. The sports bars and gels are good for a quick fix if you have forgotten to do this, or can't eat solid food due to high intensity riding or low fitness. The fitter you get (and/or the more aerobic your ride) the more easily you can eat real food without any problems. Proper sports/energy bars are a lot better for you than cakes or 'cereal' bars, including the supposedly low fat or 'light' ones, (don't look at the grammes per bar, look at the g per 100 g; ie. the %) which are packed with refined sugar and this is not even necessarily in the best form for sports use. Sports bars usually contain electrolytes as well as carbohydrate, to help replace those lost in sweat.
Carbohydrate drinks - although they are made using fairly short-chain (simple) sugars and release energy quickly, you are likely to sip them slowly over a period of time, so that you are getting a constant flow of sugar, rather than huge hit of sugar and then nothing, as with bars/gels - particularly if you're eating a whole bar/gel at a time, and not eating them at regular intervals. The drinks are not very good for your teeth for this reason though -slowly sipping a sugary drink over time means your teeth are more exposed to the sugar than if you swigged the entire bidon in one go. The same goes for fruit jiuce, which is also very acidic and may upset your stomach when you're cycling. Carb drinks usually contain electrolyte but you can also get pure electrolyte drinks that do not contain any carboyhdrate at all, and are intended simply for optimum hydration rather than to replace any lost energy (Nuun is one brand, but there are others). These could be better if you want to lose weight, as they are calorie-free, but using these you'd obviously need to eat some solid food or use sports gels, to avoid the bonk.
I'd say eating and drinking little and often is the key, but what to eat and drink, is really up to your personal preferences. I use a mixture of real food at cafes and carb drink when on the bike. I don't like the gels.