Sunday, March 31, 2024

বিল্ডার

কাদের জন্যঃ Object-oriented programming language সম্পর্কে ধারণা আছে এমন মানুষ।

যা প্রয়োজনঃclass,inheritance,composition,JavaScript সম্পর্কে পূর্ব ধারণা।

Builder: এটি object এর গঠনকে তার প্রতিনিধিত্ব থেকে আলাদা করে। সাধারণত object যদি complex হয়ে থাকে তবে সেটির creation এর ভার দেয়া হয় অন্য আরেকটি class/interfaceকে যা Builder নামে পরিচিত।এতে creation এর দরকারি methods থাকে। Concrete Builder এটিকে implement এর কাজ করে থাকে আর object এর বিভিন্ন রুপের গঠন প্রক্রিয়ার সাথে জড়িত । আরেকটি class থাকে যা Director নামে পরিচিত যা মূলত: object এর গঠন কাজকে তদারক করে থাকে Builder object এর সাহায্যে। উদাহরণে Lamp গঠন প্রক্রিয়াকে তুলে ধরা হয়েছে। এখানে BedLampBuilder class টি Bed Lamp গঠন করছে আর Director তা তদারক করছে। buildStand() আর buildShade() methods ঠিক করছে Lamp এর Stand আর Shade কি ধরণের হবে। Director এর constructor এ তিনটি argument দেয়া হয়েছে : একটি Builder object আর দু'টি হল user এর সরবরাহ করা string arguments, যা Stand আর Shade কিরকম হবে তা বলে দিচ্ছে।

উদাহরণ:
class Lamp{
constructor(){
this.l=" ";
this.s=" ";
}
Stand(t){this.l=t;}
Shade(s){this.s=s;}
des(){document.write(this.l+ ", "+this.s);}
}
class Builder{
constructor(){}
buildShade(s){}
buildStand(t){}
getLamp(){}
}
class BedLampBuilder extends Builder{
w=null;
constructor(){
super();
var q=new Lamp ();
this.w=q;
}
buildStand(t){this.w.Stand(t);}
buildShade(s){ this.w.Shade(s);}
getLamp(){return this.w;}
}
class Director{
constructor(b,s,c){
this.b=b;
this.b.buildStand(s);
this.b.buildShade(c);
}
getL(){
var a=this.b.getLamp();
return a;
}
}
var d=new Director(new BedLampBuilder(),"Black Stand","Yellow Shade");
d.getL().des();

চেষ্টা করা যাক:Progrgram টি আবার লিখি। এবার Table Lamp এর জন্য।

কৃতজ্ঞতাঃ এই লেখা তৈরি করতে দরকারি তথ্য নেয়া হয়েছে Wikipedia, আকর বই "'Design Patterns:Elements Of Reusable Object-Oriented Software' by Eric Gamma,Richard Helm,Ralph Johnson and John Vlissides(Addisson-Wesley.1994)" ও আমার তৈরি করা নানা program থেকে।
মন্তব্য ও যোগাযোগঃ mrh4478@gmail.com

Saturday, March 30, 2024

Will Tax On Remittances Lower The Inward Flow?


Idea of taxing the remitter
May bring change for the better.

Recently, IMF proposed to impose tax on remittances. The suggestion came at a moment when the country is facing severe revenue shortfall. This year NBR's revenue target is Taka 4.3 trillion, but NBR so far achieved Taka 1.65 trillion. In the first six months of current fiscal year, there is a revenue shortfall of Taka 232.27 billion. This tells how acute the financing crisis has become.

But the idea of taxing remittances is not greeted very well. Strongest argument put forward against it is the loss of remittances. Many migrant Bangladeshi workers may feel discouraged to remit money back home,opponents of the suggestion argued.

However, if we look at the Value Added Tax(VAT) revenue ,then the argument sounds hollow. Imposition of VAT did not welcome by all the quarters at the initial stage. But gradually it has become the biggest revenue earning source of the government. When initiated, it merely fetched crores of Taka in 1991. But in 2023,it fetched Taka 1.25 lakh crore. VAT's share of revenue earning increased at a remarkable pace. Now government depends less on foreign financing of the budget.

Similarly, import duty accounts for a bigger percentage of revenue earning. Duty on imports never curbed the growth of imports.Govt collected a total revenue of Taka 32,125 crores from import duties till February of 2024,registering around 11% growth. This has achieved in spite of the fact that government introduced several import restrictions in the wake of dollar crisis.

Like VAT and import duty, imposition of duty on remittances will not result in loss of remittances. A 5% tax on $20 billion worth of remittances will annually fetch around $1 billion or Taka 115 billion, ample to cover half of the revenue shortfall incurred in the first six months of this fiscal year. Part of the money will finance the incentives given to remittances repatriated to home. Universal applicability of this tax rather than to a target group will pave the path for its success. Since every remitter has to pay this tax, very few may opt for alternative channel. Government is in dubious mood about introducing such tax, fearing further increase in revenue shortfall. I think,and pretty convinced, that such measure will increase the government coffer in this troubling time. More early NBR could implement it, better improvement it may expect in revenue collection. So far NBR has not managed to get enough revenue from the traditional sources to meet its revenue goal. Giving a go to the idea of taxing the remitter may become handy.

Thursday, March 28, 2024

প্রোটোটাইপ

কাদের জন্যঃ Object-oriented programming language সম্পর্কে ধারণা আছে এমন মানুষ।

যা প্রয়োজনঃclass,inheritance,composition,JavaScript সম্পর্কে পূর্ব ধারণা।

Prototype: এটি Creational Design Pattern দলের। এর মাধ্যমে আনকোড়া নতুন object তৈরির বদলে আগে থেকে বিদ্যমান object এর copy তৈরি করা হয়। আর copy করার কাজটি করা হয় clone() এর সাহায্যে। যখন নতুন object তৈরি করা বেশ সময় সাপেক্ষ তখন এই pattern বেশ কাজে দেয়।Subclass নির্ভরতা কমিয়ে নতুন behavior যোগ করতে এবং runtime এ প্রয়োজন অনুযায়ি object তৈরি করতে এই pattern বেশ কাজে দেয়। উদাহরণে Cycle তৈরির জন্য যেসব Parts এর দরকার হয় তার Prototype আগে থেকে তৈরি করে রেখে একেবারে runtime এ Cycle object তৈরির সময় এদেরকে ব্যবহার করা হয়েছে। এখানে Parts হচ্ছে Prototype interface আর Cycle, Wheel,Frame ও BackSeat হচ্ছে এর implementation । এদের সবার clone() নামক method আছে যা ঐ class এর instance/object তৈরি করে return করছে। Cycle class এ addWheel(),addFrame() ও addBackSeat() নামক method গুলো ঐ objectকে জুড়ে দেবার কাজ করছে। CycleFact হল Cycle object assemble করার interface আর ProtoFact হচ্ছে এর implementation। ProtoFact এর method গুলোর (getWheel(),getFrame() ইত্যাদি) মাধ্যমে যেসব objects কে ProtoFact এ argument হিসেবে pass করা হয়েছিল তাদেরকে clone() করে copy করা হচ্ছে ।Cycle আমরা কেমন চাই-- Back seat সহ না Back seat ছাড়া --তার উপর নির্ভর করে আমরা runtimeএ প্রয়োজন অনুযায়ি argument দিতে পারি ProtoFact এ। এজন্য ProtoFact এ দু'ধরণের constructor রয়েছে। Runtimeএ এটি না করলে আমাদের Factory method এর মত CycleWithBackSeat এবং CycleNoBackSeat নামে আলাদা subclass তৈরি করতে হত। এই Prototype pattern ব্যবহারের ফলে আমাদের Subclassing এর উপর বেশি নির্ভর করতে হচ্ছে না আর আমরা runtime এ দরকার অনুযায়ি object যোগ/বাদ দিতে পারছি। যেমন: BackSeat দরকার নেই বলে এর object আমরা runtime-এ ProtoFact এ argument হিসেবে দেইনি।উদাহরণে Back seat ছাড়া Cycle assemble করা হয়েছে।

উদাহরণ:
class Parts{
constructor(){}
clone(){}
des(){document.write("Parts");}
}
class Wheel extends Parts{
constructor(){super();}
clone(){return new Wheel(this);}
des(){document.write("Wheel");}
}
class Frame extends Parts{
constructor(){super();}
clone(){return new Frame(this);}
des(){document.write("Frame & seat");}
}
class BackSeat extends Parts{
constructor(){super();}
clone(){return new BackSeat(this);}
des(){document.write("Back seat");}
}
class Cycle extends Parts{
w=null;
f=null;
b=null;
constructor(){super();}
addWheel(w){this.w=w;}
addFrame(f){this.f=f;}
addBackSeat(b){this.b=b;}
clone(){return new Cycle(this);}
des(){document.write("Cycle:");
this.w.des();
this.f.des();
this.b.des();
}
}
class CycleFact{
constructor(){}
makeCycle(){ return new Cycle();}
getBackSeat(){return new BackSeat();}
getFrame(){return new Frame();}
getWheel(){return new Wheel();}
}
class ProtoFact extends CycleFact{
constructor(c,w,f,b){super();
this.c=c;this.w=w; this.f=f;this.b=b;}
static trio(c,w,f,b){
return new ProtoFact(c,w,f,null);
}
static whole(c,w,f,b){
return new ProtoFact(c,w,f,b);
}
makeCycle(){ return this.c.clone();}
getBackSeat(){return this.b.clone();}
getFrame(){return this.f.clone();}
getWheel(){return this.w.clone();}
}
var p=new ProtoFact(new Cycle (),new Wheel(),new Frame());
var a=p.makeCycle();
var w=p.getWheel();
var f=p.getFrame();
a.addWheel(w);
a.addFrame(f);
a.des();

চেষ্টা করা যাক:Progrgram টি আবার লিখি। এবার Cycle এ Back seat থাকবে। দরকারি পরিবর্তন যোগ করি।

কৃতজ্ঞতাঃ এই লেখা তৈরি করতে দরকারি তথ্য নেয়া হয়েছে Wikipedia, আকর বই "'Design Patterns:Elements Of Reusable Object-Oriented Software' by Eric Gamma,Richard Helm,Ralph Johnson and John Vlissides(Addisson-Wesley.1994)" ও আমার তৈরি করা নানা program থেকে।
মন্তব্য ও যোগাযোগঃ mrh4478@gmail.com

Monday, March 25, 2024

La Semaine Dernière A Mes Yeux




(23 mars --- 29 mars)

Cliquez pour voir/cacher
Ma Semaine Gastronomique
Date Petit déjeuner/Début de jeûne Déjeuner Dîner Snacks,Sucreries,Boissons et Fritures/Fin de jeûne
23 Riz,Pomme de terre tchop,Œuf dur,Poisson latya,Pomme de terre ---- --- Pois chiches,Riz,Lait,Ruhi avec Pomme de terre
24 Riz,Pomme de terre avec Ruhi,Œuf dur --- --- Riz,Pois chiches,Lait,Ruhi
25 Riz,soupe aux lentilles,Ruhi,Latya poisson --- --- Riz,Pois chiches,Lait,Poulet,Pomme de terre
26 Riz,Œuf dur,Poulet,Pomme de terre --- --- Riz,Pois chiches,Lait
27 Riz,Poulet avec Pomme de terre --- --- Riz,Pois chiches,Petit poissons,Pomme de terre,Œuf dur
28 Riz,Petit poisson,Pomme de terre ---- --- Riz,Épinard d'eau,Pois chiches,Pomme de terre
29 Riz,Œuf dur,Koi poisson,Pomme de terre --- --- Riz,Pois chiches,gâteau traditionnel (Poa pitha)

Saturday, March 23, 2024

মেমেন্টো

কাদের জন্যঃ Object-oriented programming language সম্পর্কে ধারণা আছে এমন মানুষ।

যা প্রয়োজনঃclass,inheritance,composition,JavaScript সম্পর্কে পূর্ব ধারণা।

Memento:এটি objects এর ভেতরের অবস্থা প্রকাশ করে দেয়। object এর পূর্বের অবস্থা পুনরুদ্ধারে এই design pattern এর ব্যবহার করা হয়। এটি Behavioral Design Pattern দলের। এর প্রধান অংশ হচ্ছে:

  • Originator: যার ভেতরের অবস্থা আমাদের বিবেচনার বিষয়।
  • Caretaker:যে Originator এর উপর কাজ করে;তার ভেতরের পরিবর্তনকে পূর্বের অবস্থায় নিয়ে যেতে চায়।
  • Memento:এটি সাধারণ object; এর উপর Caretaker এর কোন প্রভাব নেই; নাম শুনেই বোঝা যাচ্ছে এটি অতীতের কোন জিনিস বা ঘটনাকে নির্দেশ করছে।
উদাহরণে Memento class B এর member হচ্ছে একটি integer এবং getInt() এর মাধ্যমে সেটি integerটিকে return করছে। Originator class A তার set() এর মাধ্যমে তার অবস্থা ঠিক করছে আর store() এর সাহায্যে তা Memento object এ রুপান্তর করছে আর getB() এর মাধ্যমে প্রযোজ্য Memento object এর integer কে প্রকাশ করে দিচ্ছে।Caretaker তার add() এর সাহায্যে Originator object এর রুপান্তর করা Memento object জমা করছে নিজের array তে। getState() এর মাধ্যমে user এর সরবরাহ করা index নিয়ে পূর্বের দরকারি Memento object কে পুনরুদ্ধার করছে।

উদাহরণ:
//memento
class B{
constructor(c){this.c=c;}
getInt(){ return this.c;}
}
//originator
class A{
constructor(){}
set(a){this.a=a;}
store(){
var b=new B(this.a);
return b;
}
getB(k){
this.a=k.getInt();
document.write(this.a);
}
}
//caretaker
class Caretaker {
constructor(){this.s=[];}
add(item){
this.s.push(item);
}
getState(ind){
return this.s[ind];
}
}
var c=new Caretaker ();
var a=new A();
a.set(2);
c.add(a.store());
a.set(3);
c.add(a.store());
a.set(4);
c.add(a.store());
a.getB(c.getState(2));

কৃতজ্ঞতাঃ এই লেখা তৈরি করতে দরকারি তথ্য নেয়া হয়েছে Wikipedia, আকর বই "'Design Patterns:Elements Of Reusable Object-Oriented Software' by Eric Gamma,Richard Helm,Ralph Johnson and John Vlissides(Addisson-Wesley.1994)" ও আমার তৈরি করা নানা program থেকে।
মন্তব্য ও যোগাযোগঃ mrh4478@gmail.com

Friday, March 22, 2024

First Commodity Exchange Sees The Light


Country launches first commodity exchange
Withering away uncertainties and ushering new change.

It is indeed a good news that country's first commodity exchange market is about to see the light. Bangladesh Stock Exchange and Commission(BSEC) has awarded Chittagong Stock Exchange (CSE) the licence to operate commodity exchange(For more read the news"CSE Gets Conditional License" by The Business Standard).Metals,agricultural commodities and hydrocarbons will be traded here at negotiated price. It will pave the path for trading futures contracts that are agreements made today to be completed at a future date. Bangladesh will be the fourth country in the subcontinent to operate commodity exchange market after India,Pakistan and Nepal.

My guess is that initially gold,coal,crude oil,LNG,rice,tea,sugar,wheat,edible oil,pulses,flower etc will be traded.Big traders cum importers,rice dealers,captive power plants, consumer goods company, super shops,posh restaurants and hotels,e-commerce platforms,banks and individual investors will be benefitted tremendously from the introduction of commodity exchange market. Banks and individual investors will see new areas of investment and unlike the stock market, the market will be opened till the midnight, ensuring trading and business activities almost an entire day. Super shops and e-commerce platforms will have better bargaining possibility with the suppliers and will see their profit margin improve significantly. Consumer goods companies and hotels will procure ingredients at negotiated prices, alleviating the uncertainties.

Commodity market is pretty volatile. Recently we have witnessed how sky rocketing prices in kitchen market squeezed the pockets of consumers from all walks of life. Unpredictability of kitchen items caused a great deal of unease among the consumers, policy planners and the true businessmen. To figure out the future market price is increasingly difficult in the context of Bangladesh. Commodity exchange market to some extent allows predictability over the prices of commodities that matter to us. The prices of commodities will be documented in the futures contracts. And markets will get information about the price based on the volume of trading of the futures contracts at the exchange. Moreover,such formal arrangement of commodity trading will draw more traders and new entrants into the commodity market. And thanks to spread of information, consumers will get regular information/update about the future prices of the commodities,which they currently do not avail.

While awarding the contract, BSEC laid down that a consumer good company had to sell its share of a brokerage firm that holds share of CSE. BSEC in this case differentiated between the interests of regulator and those of key player. But we often see producer/importer of intermediate goods also holds significant market share of the final good. In addition, such companies operate media outlets and have access to easy/cheap capital,giving it tremendous leverage over pricing of key commodities. It is no crime to go for vertical or horizontal expansion for producing an item,but proper intervention is needed when market share crosses 30% for both the intermediate goods and final goods. I think Bangladesh Competition Commission should intervene more often and regulate such overwhelming market dominating activities. In the west, we see regulators barred major operating software maker to launch new services/product that may curtail competition, discouraged production houses to launch satellite TV network fearing further market concentration, imposed punitive tariff over search engine companies to allow more competition in the industry. We expect similar moves in this country. Awarding license of commodity exchange is a precursor to an information-based market economy that will become more competitive and rescue the consumers and producers from market uncertainties.

Thursday, March 21, 2024

কম্পোজিট

কাদের জন্যঃ Object-oriented programming language সম্পর্কে ধারণা আছে এমন মানুষ।

যা প্রয়োজনঃclass,inheritance,composition,JavaScript সম্পর্কে পূর্ব ধারণা।

Composite:যখন objects দের মাঝের সম্পর্ককে part-whole সম্পর্কে রূপ দেয়া যায় এবং user কোন পার্থক্য করতে চায় না সাধারণ object এবং অনেক objects এর composition এর মাঝে তখন Composite Design Pattern ব্যবহার করা হয়। প্রধান অংশগুলো হচ্ছে: Component(composition এ objects এর interface গঠন করে এবং সব class এর জন্য common behavior [এখানে des()] implement করে),Leaf(Composition এর leaf objects কে প্রতিনিধিত্ব করে; leaf/part object এর কোন সন্তান নেই), Composite(যেসব Component objects র সন্তান আছে তাদের behavior কে define করা এবং সন্তানদের ধারণ করা )। উদাহরণে Pen ও Pencil হচ্ছে PencilBox নামের Composite class এর parts/leaves। আবার এরা সবাই Component Item কে implement করছে। তবে Pen ও Pencil সরাসরি implement করছে আর Composite class PencilBox অনুরোধকে forward করছে তার child components এর কাছে।

উদাহরণ:
*/ //component
class Item{
constructor(){}
des(){}
}
//leaf
class Pen extends Item{
constructor(){super();}
des() {
document.write("Pen");
}
}
//leaf
class Pencil extends Item{
constructor(){super();}
des() {
document.write("Pencil");
}
}
//composite
class PencilBox extends Item{
constructor(){
super();
this.a=[];
}
add(s){
this.a.push(s);
}
remove (index){
this.a.splice(index,1);
}
des(){
document.write("Pencil Box:");
for(var k=0;k < this.a.length ; k++)
{
this.a[k].des();
}
}
}
var z=new Pen();
var c=new Pencil();
var b=new PencilBox();
b.add(c);
b.add(z);
b.des();
b.remove(0);
b.des();

চেষ্টা করা যাক:Bookshelf নামে একটি program লিখি। আগের মতই Item হচ্ছে আমাদের Component আর এবার leaf হচ্ছে Book, Exercisebook ও Notebook। Composite হচ্ছে Bookshelf। আগের মতই সবার des() method থাকবে।

কৃতজ্ঞতাঃ এই লেখা তৈরি করতে দরকারি তথ্য নেয়া হয়েছে Wikipedia, আকর বই "'Design Patterns:Elements Of Reusable Object-Oriented Software' by Eric Gamma,Richard Helm,Ralph Johnson and John Vlissides(Addisson-Wesley.1994)" ও আমার তৈরি করা নানা program থেকে।
মন্তব্য ও যোগাযোগঃ mrh4478@gmail.com