Mobile Tech Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 25 December 2009

Writing Code in a New Language

Posted on 08:40 by Unknown
I'm not a developer by profession. I do enjoy a little bit of programming though. It keeps me not being utterly bored with my job following procedures that are put down by me or someone else. Also considering the fact that we do a lot of Source Code Reviews it makes sense how to learn how to write Secure Code. So I decided to learn PHP. I learnt a few things during the same; which should be globally applicable, thought I'd share it here.

-- Decide your requirements first of all. What do you need to do? You need to learn code just enough to do that.

-- Don't sit down with a huge 800 page book and learn its syntax inside out. It'll only get you frustrated. You might not want to learn a lot of it right now so read just enough so you can start writing. Its best to start writing..fast.

--Once your reqs are clear. Decide your program flow. What should happen when you click on that link? Where should it go? Get that entire flow clear in your head and even draw a little diagram ensuring your clear about the same.

--Once your "click click" flow is clear design your database if you have one. Decide which clicks need to display something on the screen. Those clicks will most probably need DB interaction. Based on what data you need to display - create your database and as many tables as you can. Don't make it too complex at this stage - design only as much as you can think of and visualize clearly. The further you can think though, the easier you will find it at a later stage.

--Once your database arch is clear decide what part of your code needs to read from which table and what part needs to write. Create database users and GRANT rights accordingly. Again like above.. you can change as you code but the further you can envision here the easier it is.

--Document all your database queries, all your GRANTS..everything. You'll be suprised at how helpful it is if you want to recreate from scratch. And trust me .. when you're new to a language you WILL recreate from scratch ..many times ;)

--Now read your first requirement - write pseudo code for it. Decide what function names you will use. Try and maintain a pattern here. You'll be surprised how much you forget about your own code.

--Once you know the structure of your code, open all the online references for the relevant functions as well as your book if you studied from one. Understand if there is existing code / functions which does what you want to do(Remember your requirements phase?)

--Start coding. Run code regularly. After every 10-20 lines print things out and see if things are working as you expected them to work. This is much better than writing 200 lines and finding out nothing works. Later when you're experienced(even then I wonder) you might not need this approach but initially when you're getting your feet wet - please code-run-code-run as much as you can.

--Enable warning/strict/all security protections you know of while you start to code. Helps you know what you're doing wrong.

--Lastly comment your code. Please.PLEASE.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • EMC Defenders CTF - Week 3 - Contest 14 - Reversing
    I played the EMC defenders CTF with a few of my friends a while back. We sadly couldn't complete all the challenges. All the same it was...
  • AuthenTec co-founder discusses how Touch ID fingerprint reader evolved from early prototypes!!!
    AuthenTec co-founder F. Scott Moody recently stopped by his alma mater to deliver a  speech  about the company he helped launch. His company...
  • Hackers breach vBulletin support forum using zero-day vulnerability!!!
    A group of European hackers by the name of Inj3ct0r Team have taken  responsibility  for hacking the support forums of vBulletin.com and the...
  • ASRock unveils a pair of motherboards designed specifically for Bitcoin mining!!!
    Those looking to generate some extra cash by mining for Bitcoin now have a couple of new hardware options courtesy of ASRock. The motherboar...
  • Amazon's trio of biospheres gets two thumbs up from Seattle Design Review Board!!!
    Earlier this year Amazon  submitted a building proposal  to construct a series of massive biospheres in downtown Seattle adjacent to three o...
  • 20 Life Hacks and Tools to Boost Productivity on Your Computer!!!
    With the flood of  new technologies , websites, apps, news, work files, pictures, articles and the like, staying organized and focused is be...
  • Why and how to set up your own wiki with Dokuwiki!!!
    DokuWiki is a simple but versatile wiki. Find out how to install, configure, and begin using DokuWiki.  A couple of weeks ago, I had to set ...
  • Chrome used more than Firefox, Opera and Internet Explorer combined!!!
    Google Chrome is absolutely dominating the web browser market, at least according to social analytics firm  Shareaholic , which yesterday re...
  • A peek at the inside of Sony's PlayStation 4!!!
    See  what's inside the PlayStation 4 with these exclusive photos  Inside Sony headquarters, at the heart of Tokyo’s Shinagawa district, ...
  • Crysis developer releases free-to-play FPS browser game Warface!!!
    Crytek is well known for its graphically impressive and visually stunning games on PC and console, but now the developer is taking its exper...

Categories

  • 100
  • 12.04
  • 2.2
  • 2013
  • 21
  • 4848
  • 8080
  • add
  • alternative
  • analysis
  • android
  • apk
  • app
  • applet
  • applets
  • appletviewer
  • application
  • appsec
  • asmx
  • assembly
  • attack
  • attacks
  • basic
  • basics
  • beginner
  • blazeds
  • blog
  • book
  • books
  • breakpoint
  • breakpoints
  • browser
  • burp
  • CALL
  • capture
  • certificate
  • chain
  • cheops
  • client side
  • code
  • conference
  • console
  • content-type
  • coverage
  • CRLF
  • cross
  • crossdomain
  • csrf
  • ctf
  • customer service
  • database
  • deblaze
  • debug
  • debugger
  • decision
  • defcon
  • delete
  • deleting
  • dll
  • dogbert
  • dom
  • dynamic
  • element
  • emulator
  • encryption
  • engineering
  • entity
  • environment
  • example
  • executable
  • external
  • firebug
  • flash
  • flex
  • FlourineFX
  • flow
  • flowchart
  • forensics
  • fs
  • fuzz
  • glassfish
  • graph
  • handbook
  • harden
  • hash
  • hints
  • hit
  • hittrace
  • howto
  • IDA
  • idapro
  • IDB
  • immunity
  • in use
  • incremental
  • inetsim
  • injection
  • install
  • introduction
  • java
  • java.policy
  • javaee
  • javascript
  • jks
  • jump
  • keyboard
  • lab
  • loaderdata
  • malware
  • management
  • mapper
  • market
  • MD Description
  • MD FAQ
  • MD Technical Support
  • MD Updates
  • MD User Guide
  • md5deep
  • mount
  • msdn
  • network
  • newbie
  • olly
  • ollydbg
  • options
  • packet
  • password
  • pbkdf
  • pcap
  • peb
  • peb_ldr_data
  • penetration
  • pentest
  • permissions
  • phone
  • pkcs12
  • policytool
  • port
  • practical
  • procedure
  • proxy
  • resign
  • resignation
  • response
  • restrict
  • reverse
  • reversing
  • review
  • salt
  • same origin
  • sample
  • scripting
  • sdk
  • secure
  • security
  • set
  • setup
  • sharif
  • shortcuts
  • SI
  • signed
  • site
  • snapshot
  • soapui
  • source
  • splitting
  • ssl
  • start
  • static
  • steps
  • stunnel
  • superblock
  • support
  • test
  • thoughts
  • thread
  • tips
  • tool
  • tools
  • tor
  • trace
  • truecrypt
  • tutorial
  • ubuntu
  • umask
  • understand
  • university
  • unsigned
  • video
  • view
  • virgin
  • virtual
  • virtual box
  • virtual machine
  • virtualbox
  • vm
  • watch
  • web
  • web application
  • web service
  • work
  • wsdl
  • xhr
  • xml
  • xss
  • xxe

Blog Archive

  • ►  2013 (496)
    • ►  November (143)
    • ►  October (297)
    • ►  September (51)
    • ►  August (2)
    • ►  March (1)
    • ►  January (2)
  • ►  2012 (16)
    • ►  October (3)
    • ►  September (1)
    • ►  August (4)
    • ►  June (1)
    • ►  May (4)
    • ►  April (2)
    • ►  February (1)
  • ►  2011 (22)
    • ►  October (1)
    • ►  September (2)
    • ►  August (1)
    • ►  July (9)
    • ►  June (1)
    • ►  May (2)
    • ►  April (6)
  • ►  2010 (8)
    • ►  August (3)
    • ►  April (2)
    • ►  January (3)
  • ▼  2009 (6)
    • ▼  December (6)
      • Parsing Excel Spreadsheets in Perl
      • Formshield Captcha Advisory
      • Writing Code in a New Language
      • Management
      • FWAuto
      • Contests I played
Powered by Blogger.

About Me

Unknown
View my complete profile